[X86][FP16] Fix crash when lowering copysign for f16
authorPhoebe Wang <phoebe.wang@intel.com>
Fri, 8 Jul 2022 00:13:29 +0000 (17:13 -0700)
committerPhoebe Wang <phoebe.wang@intel.com>
Fri, 8 Jul 2022 02:17:26 +0000 (19:17 -0700)
commit6c535f9f1bf8b9516f21353853fc3b6a33c932c6
tree45f32ccf7024c0d91c4a1b2bc44ef3c8b7b6e387
parentab9e8a3a6f280537223800f003eff21ee8e96ec6
[X86][FP16] Fix crash when lowering copysign for f16

This is to address the assertion fail reported in https://reviews.llvm.org/D107082#3635612
Not sure if it is a problem of promoting FCOPYSIGN + libcall FP_ROUND.
The promoting will set the rounding mode to 1 https://github.com/llvm/llvm-project/blob/a442c628882eb07fffff8c9f7c87a317af14555a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4810-L4814
While libcall cannot handle the rounding mode equals to 1 https://github.com/llvm/llvm-project/blob/a442c628882eb07fffff8c9f7c87a317af14555a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4324-L4328
So changing the action to Expand to workaround the problem.

Reviewed By: clementval, MaskRay

Differential Revision: https://reviews.llvm.org/D129294
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/half.ll