Skip to content

Commit

Permalink
Reland "Reland "[X86][RFC] Enable _Float16 type support on X86 foll…
Browse files Browse the repository at this point in the history
…owing the psABI""

Fixed the missing SQRT promotion. Adding several missing operations too.
  • Loading branch information
phoebewang committed Jun 15, 2022
1 parent 96ccb69 commit e1c5afa
Show file tree
Hide file tree
Showing 50 changed files with 4,862 additions and 4,604 deletions.
2 changes: 1 addition & 1 deletion llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Changes to the WebAssembly Backend
Changes to the X86 Backend
--------------------------

* ...
* Support ``half`` type on SSE2 and above targets.

Changes to the OCaml bindings
-----------------------------
Expand Down
17 changes: 10 additions & 7 deletions llvm/lib/Target/X86/X86FastISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ class X86FastISel final : public FastISel {
/// computed in an SSE register, not on the X87 floating point stack.
bool isScalarFPTypeInSSEReg(EVT VT) const {
return (VT == MVT::f64 && Subtarget->hasSSE2()) ||
(VT == MVT::f32 && Subtarget->hasSSE1()) ||
(VT == MVT::f16 && Subtarget->hasFP16());
(VT == MVT::f32 && Subtarget->hasSSE1()) || VT == MVT::f16;
}

bool isTypeLegal(Type *Ty, MVT &VT, bool AllowI1 = false);
Expand Down Expand Up @@ -2281,12 +2280,13 @@ bool X86FastISel::X86FastEmitPseudoSelect(MVT RetVT, const Instruction *I) {
default: return false;
case MVT::i8: Opc = X86::CMOV_GR8; break;
case MVT::i16: Opc = X86::CMOV_GR16; break;
case MVT::f16: Opc = X86::CMOV_FR16X; break;
case MVT::i32: Opc = X86::CMOV_GR32; break;
case MVT::f32: Opc = Subtarget->hasAVX512() ? X86::CMOV_FR32X
: X86::CMOV_FR32; break;
case MVT::f64: Opc = Subtarget->hasAVX512() ? X86::CMOV_FR64X
: X86::CMOV_FR64; break;
case MVT::f16:
Opc = Subtarget->hasAVX512() ? X86::CMOV_FR16X : X86::CMOV_FR16; break;
case MVT::f32:
Opc = Subtarget->hasAVX512() ? X86::CMOV_FR32X : X86::CMOV_FR32; break;
case MVT::f64:
Opc = Subtarget->hasAVX512() ? X86::CMOV_FR64X : X86::CMOV_FR64; break;
}

const Value *Cond = I->getOperand(0);
Expand Down Expand Up @@ -3903,6 +3903,9 @@ unsigned X86FastISel::fastMaterializeFloatZero(const ConstantFP *CF) {
unsigned Opc = 0;
switch (VT.SimpleTy) {
default: return 0;
case MVT::f16:
Opc = HasAVX512 ? X86::AVX512_FsFLD0SH : X86::FsFLD0SH;
break;
case MVT::f32:
Opc = HasAVX512 ? X86::AVX512_FsFLD0SS
: HasSSE1 ? X86::FsFLD0SS
Expand Down
Loading

0 comments on commit e1c5afa

Please sign in to comment.