This is an archive of the discontinued LLVM Phabricator instance.

[X86][MC] Avoid emitting incorrect warning for complex FMUL
ClosedPublic

Authored by pengfei on Jul 27 2022, 7:42 AM.

Details

Summary

We will insert a new operand which is identical to the Dest for complex
FMUL with a mask. https://godbolt.org/z/eTEdnYv3q

Complex FMA and FMUL with maskz don't have this problem.

Diff Detail

Event Timeline

pengfei created this revision.Jul 27 2022, 7:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 7:42 AM
pengfei requested review of this revision.Jul 27 2022, 7:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 7:42 AM
RKSimon added inline comments.Jul 27 2022, 8:04 AM
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
3851

comment?

pengfei updated this revision to Diff 448047.Jul 27 2022, 8:16 AM
pengfei marked an inline comment as done.

Add comment.

craig.topper added a comment.EditedJul 27 2022, 9:43 AM

I would replace the word "fake" in the title with "incorrect".

And "to emit" change to "emitting"

pengfei retitled this revision from [X86][MC] Avoid to emit fake warning for complex FMUL to [X86][MC] Avoid to emitting incorrect warning for complex FMUL.Jul 27 2022, 5:38 PM
LuoYuanke added inline comments.Jul 27 2022, 6:55 PM
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
3853

Just be curious. Since there is not issue for VFCMADDCPH, why for VFCMULCPH the mask version does not conform with non-mask version?

skan added a comment.Jul 27 2022, 7:37 PM

I would replace the word "fake" in the title with "incorrect".

And "to emit" change to "emitting"

"to emitting" -> "emitting"

pengfei retitled this revision from [X86][MC] Avoid to emitting incorrect warning for complex FMUL to [X86][MC] Avoid emitting incorrect warning for complex FMUL.Jul 27 2022, 7:39 PM

I would replace the word "fake" in the title with "incorrect".

And "to emit" change to "emitting"

"to emitting" -> "emitting"

🤦‍♀️

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
3853

The reason is in the differences of the input dag (generated by -print-records):

def VFCMADDCPHZr {
... ...
  dag OutOperandList = (outs VR512:$dst);
  dag InOperandList = (ins VR512:$src1, VR512:$src2, VR512:$src3);
... ...
  string Constraints = "@earlyclobber $dst, $src1 = $dst";
... ...
}
def VFMULCPHZrr {
... ...
  dag OutOperandList = (outs VR512:$dst);
  dag InOperandList = (ins VR512:$src1, VR512:$src2);
... ...
  string Constraints = "@earlyclobber $dst";
... ...
}
def VFMULCPHZrrk {
... ...
  dag OutOperandList = (outs VR512:$dst);
  dag InOperandList = (ins VR512:$src0, VK16WM:$mask, VR512:$src1, VR512:$src2);
... ...
  string Constraints = "@earlyclobber $dst, $src0 = $dst";
... ...
}
LuoYuanke added inline comments.Jul 27 2022, 7:53 PM
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
3853

Thanks, Phoebe.

LuoYuanke accepted this revision.Jul 27 2022, 7:54 PM

LGTM, thanks.

This revision is now accepted and ready to land.Jul 27 2022, 7:54 PM
skan added inline comments.Jul 27 2022, 8:03 PM
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
3853

Do we need X86II:EVEX_Z here?

3854

Using condtional operator here could be more clear

unsigned i = (TSFlags & X86II::EVEX_Z) ? 2: 1;

pengfei updated this revision to Diff 448228.Jul 27 2022, 8:21 PM
pengfei marked an inline comment as done.

Address Shengchen's comments. Thanks!

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
3853

Yeah, it's safe to remove it.

skan accepted this revision.Jul 27 2022, 8:56 PM

LGTM

This revision was landed with ongoing or failed builds.Jul 27 2022, 10:58 PM
This revision was automatically updated to reflect the committed changes.