Skip to content

Commit 1a20252

Browse files
committed
Revert "Reland "Reland "Reland "[X86][RFC] Enable _Float16 type support on X86 following the psABI""""
This reverts commit 04a3d5f. I see two more issues: - uitofp/sitofp from i32/i64 to half now generates __floatsihf/__floatdihf, which exists in neither compiler-rt nor libgcc - This crashes when legalizing the bitcast: ``` ; RUN: llc < %s -mcpu=skx define void @main.45(ptr nocapture readnone %retval, ptr noalias nocapture readnone %run_options, ptr noalias nocapture readnone %params, ptr noalias nocapture readonly %buffer_table, ptr noalias nocapture readnone %status, ptr noalias nocapture readnone %prof_counters) local_unnamed_addr { entry: %fusion = load ptr, ptr %buffer_table, align 8 %0 = getelementptr inbounds ptr, ptr %buffer_table, i64 1 %Arg_1.2 = load ptr, ptr %0, align 8 %1 = getelementptr inbounds ptr, ptr %buffer_table, i64 2 %Arg_0.1 = load ptr, ptr %1, align 8 %2 = load half, ptr %Arg_0.1, align 8 %3 = bitcast half %2 to i16 %4 = and i16 %3, 32767 %5 = icmp eq i16 %4, 0 %6 = and i16 %3, -32768 %broadcast.splatinsert = insertelement <4 x half> poison, half %2, i64 0 %broadcast.splat = shufflevector <4 x half> %broadcast.splatinsert, <4 x half> poison, <4 x i32> zeroinitializer %broadcast.splatinsert9 = insertelement <4 x i16> poison, i16 %4, i64 0 %broadcast.splat10 = shufflevector <4 x i16> %broadcast.splatinsert9, <4 x i16> poison, <4 x i32> zeroinitializer %broadcast.splatinsert11 = insertelement <4 x i16> poison, i16 %6, i64 0 %broadcast.splat12 = shufflevector <4 x i16> %broadcast.splatinsert11, <4 x i16> poison, <4 x i32> zeroinitializer %broadcast.splatinsert13 = insertelement <4 x i16> poison, i16 %3, i64 0 %broadcast.splat14 = shufflevector <4 x i16> %broadcast.splatinsert13, <4 x i16> poison, <4 x i32> zeroinitializer %wide.load = load <4 x half>, ptr %Arg_1.2, align 8 %7 = fcmp uno <4 x half> %broadcast.splat, %wide.load %8 = fcmp oeq <4 x half> %broadcast.splat, %wide.load %9 = bitcast <4 x half> %wide.load to <4 x i16> %10 = and <4 x i16> %9, <i16 32767, i16 32767, i16 32767, i16 32767> %11 = icmp eq <4 x i16> %10, zeroinitializer %12 = and <4 x i16> %9, <i16 -32768, i16 -32768, i16 -32768, i16 -32768> %13 = or <4 x i16> %12, <i16 1, i16 1, i16 1, i16 1> %14 = select <4 x i1> %11, <4 x i16> %9, <4 x i16> %13 %15 = icmp ugt <4 x i16> %broadcast.splat10, %10 %16 = icmp ne <4 x i16> %broadcast.splat12, %12 %17 = or <4 x i1> %15, %16 %18 = select <4 x i1> %17, <4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>, <4 x i16> <i16 1, i16 1, i16 1, i16 1> %19 = add <4 x i16> %18, %broadcast.splat14 %20 = select i1 %5, <4 x i16> %14, <4 x i16> %19 %21 = select <4 x i1> %8, <4 x i16> %9, <4 x i16> %20 %22 = bitcast <4 x i16> %21 to <4 x half> %23 = select <4 x i1> %7, <4 x half> <half 0xH7E00, half 0xH7E00, half 0xH7E00, half 0xH7E00>, <4 x half> %22 store <4 x half> %23, ptr %fusion, align 16 ret void } ``` llc: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:977: void (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode *): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
1 parent 5ea341d commit 1a20252

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4605
-4942
lines changed

llvm/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Changes to the WebAssembly Backend
138138
Changes to the X86 Backend
139139
--------------------------
140140

141-
* Support ``half`` type on SSE2 and above targets.
141+
* ...
142142

143143
Changes to the OCaml bindings
144144
-----------------------------

llvm/lib/Target/X86/X86FastISel.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ class X86FastISel final : public FastISel {
148148
/// computed in an SSE register, not on the X87 floating point stack.
149149
bool isScalarFPTypeInSSEReg(EVT VT) const {
150150
return (VT == MVT::f64 && Subtarget->hasSSE2()) ||
151-
(VT == MVT::f32 && Subtarget->hasSSE1()) || VT == MVT::f16;
151+
(VT == MVT::f32 && Subtarget->hasSSE1()) ||
152+
(VT == MVT::f16 && Subtarget->hasFP16());
152153
}
153154

154155
bool isTypeLegal(Type *Ty, MVT &VT, bool AllowI1 = false);
@@ -2280,13 +2281,12 @@ bool X86FastISel::X86FastEmitPseudoSelect(MVT RetVT, const Instruction *I) {
22802281
default: return false;
22812282
case MVT::i8: Opc = X86::CMOV_GR8; break;
22822283
case MVT::i16: Opc = X86::CMOV_GR16; break;
2284+
case MVT::f16: Opc = X86::CMOV_FR16X; break;
22832285
case MVT::i32: Opc = X86::CMOV_GR32; break;
2284-
case MVT::f16:
2285-
Opc = Subtarget->hasAVX512() ? X86::CMOV_FR16X : X86::CMOV_FR16; break;
2286-
case MVT::f32:
2287-
Opc = Subtarget->hasAVX512() ? X86::CMOV_FR32X : X86::CMOV_FR32; break;
2288-
case MVT::f64:
2289-
Opc = Subtarget->hasAVX512() ? X86::CMOV_FR64X : X86::CMOV_FR64; break;
2286+
case MVT::f32: Opc = Subtarget->hasAVX512() ? X86::CMOV_FR32X
2287+
: X86::CMOV_FR32; break;
2288+
case MVT::f64: Opc = Subtarget->hasAVX512() ? X86::CMOV_FR64X
2289+
: X86::CMOV_FR64; break;
22902290
}
22912291

22922292
const Value *Cond = I->getOperand(0);
@@ -3903,9 +3903,6 @@ unsigned X86FastISel::fastMaterializeFloatZero(const ConstantFP *CF) {
39033903
unsigned Opc = 0;
39043904
switch (VT.SimpleTy) {
39053905
default: return 0;
3906-
case MVT::f16:
3907-
Opc = HasAVX512 ? X86::AVX512_FsFLD0SH : X86::FsFLD0SH;
3908-
break;
39093906
case MVT::f32:
39103907
Opc = HasAVX512 ? X86::AVX512_FsFLD0SS
39113908
: HasSSE1 ? X86::FsFLD0SS

0 commit comments

Comments
 (0)