https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106113
Bug ID: 106113 Summary: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result. Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: lingling.kong7 at gmail dot com Target Milestone: --- https://gcc.godbolt.org/z/svoqvKs55 for _mm_ucomineq_ss, according to the instruction description, Operation (V)UCOMISS (all versions) RESULT := UnorderedCompare(DEST[31:0] <> SRC[31:0]) { (* Set EFLAGS *) CASE (RESULT) OF UNORDERED: ZF,PF,CF := 111; GREATER_THAN: ZF,PF,CF := 000; LESS_THAN: ZF,PF,CF := 001; EQUAL: ZF,PF,CF := 100; ESAC; OF, AF, SF := 0; } result need to set PF = 1, but now generate code for `_mm_ucomineq_ss` is # gcc -O3 -mavx512f xorl %eax, %eax vucomiss %xmm1, %xmm0 setne %al ret it ignore PF result, the codegen in llvm for this is correct. We also could refer to the codegen in gcc for '_mm_comi_round_ss(__A, __B, 4, _MM_FROUND_NO_EXC); '