https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102811
Bug ID: 102811 Summary: vcvtph2ps and vcvtps2ph should be used to convert _Float16 to SFmode with -mf16c Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ubizjak at gmail dot com Target Milestone: --- The following testcase: _Float16 test (_Float16 a, _Float16 b) { return a + b; } compiles with -O2 -mf16c to: --cut here-- subq $24, %rsp pextrw $0, %xmm1, 14(%rsp) call __extendhfsf2 pinsrw $0, 14(%rsp), %xmm1 vmovss %xmm0, 8(%rsp) vmovss %xmm1, %xmm1, %xmm0 call __extendhfsf2 vaddss 8(%rsp), %xmm0, %xmm0 call __truncsfhf2 addq $24, %rsp ret --cut here-- Instead of calling __extendhfsf2 and __truncsfhf2, we should use vcvtph2ps and vcvtps2ph (with zeroed elements 1..3) for -m16c targets.