diff --git a/llvm/lib/Target/X86/GISel/X86InstructionSelector.cpp b/llvm/lib/Target/X86/GISel/X86InstructionSelector.cpp index ee456a11d5844..9c35b1c06b187 100644 --- a/llvm/lib/Target/X86/GISel/X86InstructionSelector.cpp +++ b/llvm/lib/Target/X86/GISel/X86InstructionSelector.cpp @@ -1048,6 +1048,13 @@ bool X86InstructionSelector::selectFCmp(MachineInstr &I, break; } + assert((LhsReg.isVirtual() && RhsReg.isVirtual()) && + "Both arguments of FCMP need to be virtual!"); + auto *LhsBank = RBI.getRegBank(LhsReg, MRI, TRI); + auto *RhsBank = RBI.getRegBank(RhsReg, MRI, TRI); + assert((LhsBank == RhsBank) && + "Both banks assigned to FCMP arguments need to be same!"); + // Compute the opcode for the CMP instruction. unsigned OpCmp; LLT Ty = MRI.getType(LhsReg); @@ -1055,10 +1062,15 @@ bool X86InstructionSelector::selectFCmp(MachineInstr &I, default: return false; case 32: - OpCmp = X86::UCOMISSrr; + OpCmp = LhsBank->getID() == X86::PSRRegBankID ? X86::UCOM_FpIr32 + : X86::UCOMISSrr; break; case 64: - OpCmp = X86::UCOMISDrr; + OpCmp = LhsBank->getID() == X86::PSRRegBankID ? X86::UCOM_FpIr64 + : X86::UCOMISDrr; + break; + case 80: + OpCmp = X86::UCOM_FpIr80; break; } diff --git a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp index bab7fe9d25e44..c7fa3d65ac035 100644 --- a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp +++ b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp @@ -448,10 +448,9 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI, // fp comparison getActionDefinitionsBuilder(G_FCMP) - .legalIf([=](const LegalityQuery &Query) { - return (HasSSE1 && typePairInSet(0, 1, {{s8, s32}})(Query)) || - (HasSSE2 && typePairInSet(0, 1, {{s8, s64}})(Query)); - }) + .legalFor(HasSSE1 || UseX87, {s8, s32}) + .legalFor(HasSSE2 || UseX87, {s8, s64}) + .legalFor(UseX87, {s8, s80}) .clampScalar(0, s8, s8) .clampScalar(1, s32, HasSSE2 ? s64 : s32) .widenScalarToNextPow2(1); diff --git a/llvm/lib/Target/X86/GISel/X86RegisterBankInfo.cpp b/llvm/lib/Target/X86/GISel/X86RegisterBankInfo.cpp index 43c0145ec8e2a..42faf4299c6d5 100644 --- a/llvm/lib/Target/X86/GISel/X86RegisterBankInfo.cpp +++ b/llvm/lib/Target/X86/GISel/X86RegisterBankInfo.cpp @@ -321,8 +321,8 @@ X86RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { unsigned Size = Ty1.getSizeInBits(); (void)Size; - assert((Size == 32 || Size == 64) && "Unsupported size for G_FCMP"); - + assert((Size == 32 || Size == 64 || Size == 80) && + "Unsupported size for G_FCMP"); auto FpRegBank = getPartialMappingIdx(MI, Ty1, /* isFP= */ true); OpRegBankIdx = {PMI_GPR8, /* Predicate */ PMI_None, FpRegBank, FpRegBank}; diff --git a/llvm/test/CodeGen/X86/GlobalISel/isel-fcmp-i686.mir b/llvm/test/CodeGen/X86/GlobalISel/isel-fcmp-i686.mir new file mode 100644 index 0000000000000..fb4e25f2a5ced --- /dev/null +++ b/llvm/test/CodeGen/X86/GlobalISel/isel-fcmp-i686.mir @@ -0,0 +1,399 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# NOTE: This MIR test is required because the support for 64 bit memory ops is missing in i686 mode, Due to distinction between float/int types, support is expected in near future and there is this RFC in place https://discourse.llvm.org/t/rfc-globalisel-adding-fp-type-information-to-llt/83349. Once this support is introduced this test must be dropped and integrated into the LLVM IR tests. +# RUN: llc -mtriple=i686-linux-gnu -mattr=+x87,-sse,-sse2 -run-pass=regbankselect,instruction-select -disable-gisel-legality-check -global-isel %s -o - | FileCheck %s --check-prefixes GISEL-X86 + +--- +name: fcmp_double_oeq +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } + +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_oeq + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags + ; GISEL-X86-NEXT: [[SETCCr1:%[0-9]+]]:gr8 = SETCCr 11, implicit $eflags + ; GISEL-X86-NEXT: [[AND8rr:%[0-9]+]]:gr8 = AND8rr [[SETCCr]], [[SETCCr1]], implicit-def $eflags + ; GISEL-X86-NEXT: $al = COPY [[AND8rr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(oeq), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ogt +alignment: 16 +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } + +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ogt + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 7, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ogt), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_oge +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_oge + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 3, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(oge), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_olt +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } + +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_olt + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m1]], [[LD_Fp64m]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 7, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(olt), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ole +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ole + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m1]], [[LD_Fp64m]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 3, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ole), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_one +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_one + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 5, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(one), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ord +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ord + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 11, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ord), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_uno +alignment: 16 +exposesReturnsTwice: false +legalized: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_uno + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 10, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(uno), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ueq +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ueq + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ueq), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ugt +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } + +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ugt + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m1]], [[LD_Fp64m]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 2, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ugt), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_uge +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_uge + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m1]], [[LD_Fp64m]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 6, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(uge), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ult +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true + +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ult + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 2, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ult), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_ule +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +stack: [] +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_ule + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 6, implicit $eflags + ; GISEL-X86-NEXT: $al = COPY [[SETCCr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(ule), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al + +... +--- +name: fcmp_double_une +alignment: 16 +exposesReturnsTwice: false +legalized: true +tracksRegLiveness: true +fixedStack: + - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default, + isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +body: | + bb.1.entry: + ; GISEL-X86-LABEL: name: fcmp_double_une + ; GISEL-X86: [[LD_Fp64m:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0) + ; GISEL-X86-NEXT: [[LD_Fp64m1:%[0-9]+]]:rfp64 = LD_Fp64m %fixed-stack.0, 1, $noreg, 0, $noreg, implicit-def $fpsw, implicit $fpcw :: (invariant load (s64) from %fixed-stack.0 + 8) + ; GISEL-X86-NEXT: UCOM_FpIr64 [[LD_Fp64m]], [[LD_Fp64m1]], implicit-def $eflags, implicit-def $fpsw, implicit $fpcw + ; GISEL-X86-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 5, implicit $eflags + ; GISEL-X86-NEXT: [[SETCCr1:%[0-9]+]]:gr8 = SETCCr 10, implicit $eflags + ; GISEL-X86-NEXT: [[OR8rr:%[0-9]+]]:gr8 = OR8rr [[SETCCr]], [[SETCCr1]], implicit-def $eflags + ; GISEL-X86-NEXT: $al = COPY [[OR8rr]] + ; GISEL-X86-NEXT: RET 0, implicit $al + %3:_(p0) = G_FRAME_INDEX %fixed-stack.0 + %2:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0, align 8) + %1:_(s64) = G_LOAD %3(p0) :: (invariant load (s64) from %fixed-stack.0 + 8, basealign 8) + %4:_(s8) = G_FCMP floatpred(une), %2(s64), %1 + $al = COPY %4(s8) + RET 0, implicit $al +... diff --git a/llvm/test/CodeGen/X86/isel-fcmp-x87.ll b/llvm/test/CodeGen/X86/isel-fcmp-x87.ll new file mode 100644 index 0000000000000..8c2a53082649a --- /dev/null +++ b/llvm/test/CodeGen/X86/isel-fcmp-x87.ll @@ -0,0 +1,1496 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+x87,-sse,-sse2 -verify-machineinstrs | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 -mattr=+x87,-sse,-sse2 -verify-machineinstrs | FileCheck %s --check-prefixes=X64,FAST-X64 +; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-apple-darwin10 -mattr=+x87,-sse,-sse2 -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL-X64 +; RUN: llc < %s -mtriple=i686-apple-darwin10 -mattr=+x87,-sse,-sse2 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,SDAG-X86 +; Allow fast-isel to fallback to selection dag on x86 +; RUN: llc < %s -fast-isel -mtriple=i686-apple-darwin10 -mattr=+x87,-sse,-sse2 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,FAST-X86 +; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=i686-apple-darwin10 -mattr=+x87,-sse,-sse2 -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL-X86 + + define i1 @fcmp_x86_fp80_oeq(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_oeq: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setnp %cl +; X64-NEXT: sete %al +; X64-NEXT: andb %cl, %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_oeq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: sete %cl +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: andb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_oeq: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %cl +; X86-NEXT: sete %al +; X86-NEXT: andb %cl, %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_oeq: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: sete %cl +; GISEL-X86-NEXT: setnp %al +; GISEL-X86-NEXT: andb %cl, %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp oeq x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ogt(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_ogt: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: seta %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ogt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_ogt: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: seta %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ogt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: seta %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ogt x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_oge(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_oge: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setae %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_oge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_oge: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setae %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_oge: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setae %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp oge x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_olt(x86_fp80 %x, x86_fp80 %y) nounwind { +; SDAG-X64-LABEL: fcmp_x86_fp80_olt: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: seta %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_x86_fp80_olt: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: seta %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_olt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_x86_fp80_olt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: seta %al +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_x86_fp80_olt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: subl $12, %esp +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: seta %al +; FAST-X86-NEXT: addl $12, %esp +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_olt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: seta %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp olt x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ole(x86_fp80 %x, x86_fp80 %y) nounwind { +; SDAG-X64-LABEL: fcmp_x86_fp80_ole: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: setae %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_x86_fp80_ole: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: setae %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ole: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_x86_fp80_ole: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setae %al +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_x86_fp80_ole: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: subl $12, %esp +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setae %al +; FAST-X86-NEXT: addl $12, %esp +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ole: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setae %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ole x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_one(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_one: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setne %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_one: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_one: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setne %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_one: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setne %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp one x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ord(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_ord: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setnp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ord: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_ord: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ord: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setnp %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ord x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_uno(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_uno: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_uno: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_uno: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_uno: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setp %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp uno x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ueq(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_ueq: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ueq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_ueq: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: sete %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ueq: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: sete %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ueq x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ugt(x86_fp80 %x, x86_fp80 %y) nounwind { +; SDAG-X64-LABEL: fcmp_x86_fp80_ugt: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: setb %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_x86_fp80_ugt: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: setb %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ugt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_x86_fp80_ugt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setb %al +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_x86_fp80_ugt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: subl $12, %esp +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setb %al +; FAST-X86-NEXT: addl $12, %esp +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ugt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setb %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ugt x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_uge(x86_fp80 %x, x86_fp80 %y) nounwind { +; SDAG-X64-LABEL: fcmp_x86_fp80_uge: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: setbe %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_x86_fp80_uge: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: setbe %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_uge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_x86_fp80_uge: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: subl $12, %esp +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldt {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setbe %al +; SDAG-X86-NEXT: addl $12, %esp +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_x86_fp80_uge: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: subl $12, %esp +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldt {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setbe %al +; FAST-X86-NEXT: addl $12, %esp +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_uge: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setbe %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp uge x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ult(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_ult: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setb %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ult: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_ult: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setb %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ult: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setb %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ult x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_ule(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_ule: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setbe %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_ule: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_ule: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setbe %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_ule: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setbe %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp ule x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_x86_fp80_une(x86_fp80 %x, x86_fp80 %y) nounwind { +; X64-LABEL: fcmp_x86_fp80_une: +; X64: ## %bb.0: +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fldt {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setp %cl +; X64-NEXT: setne %al +; X64-NEXT: orb %cl, %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_x86_fp80_une: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setne %cl +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: orb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_x86_fp80_une: +; X86: ## %bb.0: +; X86-NEXT: subl $12, %esp +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fldt {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %cl +; X86-NEXT: setne %al +; X86-NEXT: orb %cl, %al +; X86-NEXT: addl $12, %esp +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_x86_fp80_une: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: subl $12, %esp +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setne %cl +; GISEL-X86-NEXT: setp %al +; GISEL-X86-NEXT: orb %cl, %al +; GISEL-X86-NEXT: addl $12, %esp +; GISEL-X86-NEXT: retl + %1 = fcmp une x86_fp80 %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_oeq(float %x, float %y) { +; X64-LABEL: fcmp_float_oeq: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setnp %cl +; X64-NEXT: sete %al +; X64-NEXT: andb %cl, %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_oeq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: sete %cl +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: andb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_oeq: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %cl +; X86-NEXT: sete %al +; X86-NEXT: andb %cl, %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_oeq: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: sete %cl +; GISEL-X86-NEXT: setnp %al +; GISEL-X86-NEXT: andb %cl, %al +; GISEL-X86-NEXT: retl + %1 = fcmp oeq float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ogt(float %x, float %y) { +; X64-LABEL: fcmp_float_ogt: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: seta %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ogt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ogt: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: seta %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ogt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: seta %al +; GISEL-X86-NEXT: retl + %1 = fcmp ogt float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_oge(float %x, float %y) { +; X64-LABEL: fcmp_float_oge: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setae %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_oge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_oge: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setae %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_oge: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setae %al +; GISEL-X86-NEXT: retl + %1 = fcmp oge float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_olt(float %x, float %y) { +; SDAG-X64-LABEL: fcmp_float_olt: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: seta %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_float_olt: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: seta %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_olt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_olt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: seta %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_olt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: seta %al +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_olt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: seta %al +; GISEL-X86-NEXT: retl + %1 = fcmp olt float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ole(float %x, float %y) { +; SDAG-X64-LABEL: fcmp_float_ole: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: setae %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_float_ole: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: setae %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ole: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_ole: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setae %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_ole: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setae %al +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ole: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setae %al +; GISEL-X86-NEXT: retl + %1 = fcmp ole float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_one(float %x, float %y) { +; X64-LABEL: fcmp_float_one: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setne %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_one: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_one: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setne %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_one: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setne %al +; GISEL-X86-NEXT: retl + %1 = fcmp one float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ord(float %x, float %y) { +; X64-LABEL: fcmp_float_ord: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setnp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ord: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ord: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ord: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setnp %al +; GISEL-X86-NEXT: retl + %1 = fcmp ord float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_uno(float %x, float %y) { +; X64-LABEL: fcmp_float_uno: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_uno: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_uno: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_uno: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setp %al +; GISEL-X86-NEXT: retl + %1 = fcmp uno float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ueq(float %x, float %y) { +; X64-LABEL: fcmp_float_ueq: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ueq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ueq: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: sete %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ueq: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: sete %al +; GISEL-X86-NEXT: retl + %1 = fcmp ueq float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ugt(float %x, float %y) { +; SDAG-X64-LABEL: fcmp_float_ugt: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: setb %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_float_ugt: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: setb %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ugt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_ugt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setb %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_ugt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setb %al +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ugt: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setb %al +; GISEL-X86-NEXT: retl + %1 = fcmp ugt float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_uge(float %x, float %y) { +; SDAG-X64-LABEL: fcmp_float_uge: +; SDAG-X64: ## %bb.0: +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: flds {{[0-9]+}}(%rsp) +; SDAG-X64-NEXT: fucompi %st(1), %st +; SDAG-X64-NEXT: fstp %st(0) +; SDAG-X64-NEXT: setbe %al +; SDAG-X64-NEXT: retq +; +; FAST-X64-LABEL: fcmp_float_uge: +; FAST-X64: ## %bb.0: +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: flds {{[0-9]+}}(%rsp) +; FAST-X64-NEXT: fxch %st(1) +; FAST-X64-NEXT: fucompi %st(1), %st +; FAST-X64-NEXT: fstp %st(0) +; FAST-X64-NEXT: setbe %al +; FAST-X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_uge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_uge: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setbe %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_uge: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setbe %al +; FAST-X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_uge: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setbe %al +; GISEL-X86-NEXT: retl + %1 = fcmp uge float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ult(float %x, float %y) { +; X64-LABEL: fcmp_float_ult: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setb %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ult: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ult: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setb %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ult: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setb %al +; GISEL-X86-NEXT: retl + %1 = fcmp ult float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ule(float %x, float %y) { +; X64-LABEL: fcmp_float_ule: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setbe %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ule: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ule: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setbe %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_ule: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setbe %al +; GISEL-X86-NEXT: retl + %1 = fcmp ule float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_une(float %x, float %y) { +; X64-LABEL: fcmp_float_une: +; X64: ## %bb.0: +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: flds {{[0-9]+}}(%rsp) +; X64-NEXT: fucompi %st(1), %st +; X64-NEXT: fstp %st(0) +; X64-NEXT: setp %cl +; X64-NEXT: setne %al +; X64-NEXT: orb %cl, %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_une: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: flds {{[0-9]+}}(%rsp) +; GISEL-X64-NEXT: fxch %st(1) +; GISEL-X64-NEXT: fucompi %st(1), %st +; GISEL-X64-NEXT: fstp %st(0) +; GISEL-X64-NEXT: setne %cl +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: orb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_une: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %cl +; X86-NEXT: setne %al +; X86-NEXT: orb %cl, %al +; X86-NEXT: retl +; +; GISEL-X86-LABEL: fcmp_float_une: +; GISEL-X86: ## %bb.0: +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp) +; GISEL-X86-NEXT: fxch %st(1) +; GISEL-X86-NEXT: fucompi %st(1), %st +; GISEL-X86-NEXT: fstp %st(0) +; GISEL-X86-NEXT: setne %cl +; GISEL-X86-NEXT: setp %al +; GISEL-X86-NEXT: orb %cl, %al +; GISEL-X86-NEXT: retl + %1 = fcmp une float %x, %y + ret i1 %1 + } diff --git a/llvm/test/CodeGen/X86/isel-fcmp.ll b/llvm/test/CodeGen/X86/isel-fcmp.ll new file mode 100644 index 0000000000000..4a223aaa4149b --- /dev/null +++ b/llvm/test/CodeGen/X86/isel-fcmp.ll @@ -0,0 +1,888 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+sse,+sse2,-x87 -verify-machineinstrs | FileCheck %s --check-prefixes=X64,SDAG-X64 +; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 -mattr=+sse,+sse2,-x87 -verify-machineinstrs | FileCheck %s --check-prefixes=X64,FAST-X64 +; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-apple-darwin10 -mattr=+sse,+sse2,-x87 -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL-X64 +; i686 with 64 bit store is issue. +; RUN: llc < %s -mtriple=i686-apple-darwin10 -mattr=-sse,-sse2,+x87 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,SDAG-X86 +; Allow fast-isel to fallback to selection dag on x86 +; RUN: llc < %s -fast-isel -mtriple=i686-apple-darwin10 -mattr=-sse,-sse2,+x87 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,FAST-X86 +; llc < %s -global-isel -global-isel-abort=1 -mtriple=i686-apple-darwin10 -mattr=-sse,-sse2,+x87 -verify-machineinstrs | FileCheck %s --check-prefixes=GISEL-X86 + + define i1 @fcmp_float_oeq(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_oeq: +; X64: ## %bb.0: +; X64-NEXT: cmpeqss %xmm1, %xmm0 +; X64-NEXT: movd %xmm0, %eax +; X64-NEXT: andl $1, %eax +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_oeq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %cl +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: andb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_oeq: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %cl +; X86-NEXT: sete %al +; X86-NEXT: andb %cl, %al +; X86-NEXT: retl + %1 = fcmp oeq float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ogt(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ogt: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: seta %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ogt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ogt: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: seta %al +; X86-NEXT: retl + %1 = fcmp ogt float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_oge(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_oge: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: setae %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_oge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_oge: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setae %al +; X86-NEXT: retl + %1 = fcmp oge float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_olt(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_olt: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: seta %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_olt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_olt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: seta %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_olt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: seta %al +; FAST-X86-NEXT: retl + %1 = fcmp olt float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ole(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ole: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: setae %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ole: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_ole: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setae %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_ole: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setae %al +; FAST-X86-NEXT: retl + %1 = fcmp ole float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_one(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_one: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: setne %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_one: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_one: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setne %al +; X86-NEXT: retl + %1 = fcmp one float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ord(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ord: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: setnp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ord: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ord: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %al +; X86-NEXT: retl + %1 = fcmp ord float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_uno(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_uno: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: setp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_uno: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_uno: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %al +; X86-NEXT: retl + %1 = fcmp uno float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ueq(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ueq: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ueq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ueq: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: sete %al +; X86-NEXT: retl + %1 = fcmp ueq float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ugt(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ugt: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: setb %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ugt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_ugt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setb %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_ugt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setb %al +; FAST-X86-NEXT: retl + %1 = fcmp ugt float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_uge(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_uge: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm0, %xmm1 +; X64-NEXT: setbe %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_uge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm0, %xmm1 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_float_uge: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: flds {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setbe %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_float_uge: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: flds {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setbe %al +; FAST-X86-NEXT: retl + %1 = fcmp uge float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ult(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ult: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: setb %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ult: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ult: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setb %al +; X86-NEXT: retl + %1 = fcmp ult float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_ule(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_ule: +; X64: ## %bb.0: +; X64-NEXT: ucomiss %xmm1, %xmm0 +; X64-NEXT: setbe %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_ule: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_ule: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setbe %al +; X86-NEXT: retl + %1 = fcmp ule float %x, %y + ret i1 %1 + } + + define i1 @fcmp_float_une(float %x, float %y) nounwind { +; X64-LABEL: fcmp_float_une: +; X64: ## %bb.0: +; X64-NEXT: cmpneqss %xmm1, %xmm0 +; X64-NEXT: movd %xmm0, %eax +; X64-NEXT: andl $1, %eax +; X64-NEXT: ## kill: def $al killed $al killed $eax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_float_une: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomiss %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %cl +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: orb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_float_une: +; X86: ## %bb.0: +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: flds {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %cl +; X86-NEXT: setne %al +; X86-NEXT: orb %cl, %al +; X86-NEXT: retl + %1 = fcmp une float %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_oeq(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_oeq: +; X64: ## %bb.0: +; X64-NEXT: cmpeqsd %xmm1, %xmm0 +; X64-NEXT: movq %xmm0, %rax +; X64-NEXT: andl $1, %eax +; X64-NEXT: ## kill: def $al killed $al killed $rax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_oeq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %cl +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: andb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_oeq: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %cl +; X86-NEXT: sete %al +; X86-NEXT: andb %cl, %al +; X86-NEXT: retl + %1 = fcmp oeq double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ogt(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ogt: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: seta %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ogt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_ogt: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: seta %al +; X86-NEXT: retl + %1 = fcmp ogt double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_oge(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_oge: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: setae %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_oge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_oge: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setae %al +; X86-NEXT: retl + %1 = fcmp oge double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_olt(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_olt: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm0, %xmm1 +; X64-NEXT: seta %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_olt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm0, %xmm1 +; GISEL-X64-NEXT: seta %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_double_olt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: seta %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_double_olt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: seta %al +; FAST-X86-NEXT: retl + %1 = fcmp olt double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ole(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ole: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm0, %xmm1 +; X64-NEXT: setae %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ole: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm0, %xmm1 +; GISEL-X64-NEXT: setae %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_double_ole: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setae %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_double_ole: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setae %al +; FAST-X86-NEXT: retl + %1 = fcmp ole double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_one(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_one: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: setne %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_one: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_one: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setne %al +; X86-NEXT: retl + %1 = fcmp one double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ord(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ord: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: setnp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ord: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setnp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_ord: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setnp %al +; X86-NEXT: retl + %1 = fcmp ord double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_uno(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_uno: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: setp %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_uno: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_uno: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %al +; X86-NEXT: retl + %1 = fcmp uno double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ueq(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ueq: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: sete %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ueq: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: sete %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_ueq: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: sete %al +; X86-NEXT: retl + %1 = fcmp ueq double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ugt(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ugt: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm0, %xmm1 +; X64-NEXT: setb %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ugt: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm0, %xmm1 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_double_ugt: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setb %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_double_ugt: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setb %al +; FAST-X86-NEXT: retl + %1 = fcmp ugt double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_uge(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_uge: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm0, %xmm1 +; X64-NEXT: setbe %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_uge: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm0, %xmm1 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; SDAG-X86-LABEL: fcmp_double_uge: +; SDAG-X86: ## %bb.0: +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fldl {{[0-9]+}}(%esp) +; SDAG-X86-NEXT: fucompp +; SDAG-X86-NEXT: fnstsw %ax +; SDAG-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; SDAG-X86-NEXT: sahf +; SDAG-X86-NEXT: setbe %al +; SDAG-X86-NEXT: retl +; +; FAST-X86-LABEL: fcmp_double_uge: +; FAST-X86: ## %bb.0: +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fldl {{[0-9]+}}(%esp) +; FAST-X86-NEXT: fxch %st(1) +; FAST-X86-NEXT: fucompp +; FAST-X86-NEXT: fnstsw %ax +; FAST-X86-NEXT: ## kill: def $ah killed $ah killed $ax +; FAST-X86-NEXT: sahf +; FAST-X86-NEXT: setbe %al +; FAST-X86-NEXT: retl + %1 = fcmp uge double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ult(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ult: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: setb %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ult: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setb %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_ult: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setb %al +; X86-NEXT: retl + %1 = fcmp ult double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_ule(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_ule: +; X64: ## %bb.0: +; X64-NEXT: ucomisd %xmm1, %xmm0 +; X64-NEXT: setbe %al +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_ule: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setbe %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_ule: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setbe %al +; X86-NEXT: retl + %1 = fcmp ule double %x, %y + ret i1 %1 + } + + define i1 @fcmp_double_une(double %x, double %y) nounwind { +; X64-LABEL: fcmp_double_une: +; X64: ## %bb.0: +; X64-NEXT: cmpneqsd %xmm1, %xmm0 +; X64-NEXT: movq %xmm0, %rax +; X64-NEXT: andl $1, %eax +; X64-NEXT: ## kill: def $al killed $al killed $rax +; X64-NEXT: retq +; +; GISEL-X64-LABEL: fcmp_double_une: +; GISEL-X64: ## %bb.0: +; GISEL-X64-NEXT: ucomisd %xmm1, %xmm0 +; GISEL-X64-NEXT: setne %cl +; GISEL-X64-NEXT: setp %al +; GISEL-X64-NEXT: orb %cl, %al +; GISEL-X64-NEXT: retq +; +; X86-LABEL: fcmp_double_une: +; X86: ## %bb.0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fucompp +; X86-NEXT: fnstsw %ax +; X86-NEXT: ## kill: def $ah killed $ah killed $ax +; X86-NEXT: sahf +; X86-NEXT: setp %cl +; X86-NEXT: setne %al +; X86-NEXT: orb %cl, %al +; X86-NEXT: retl + %1 = fcmp une double %x, %y + ret i1 %1 + } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; FAST-X64: {{.*}} +; SDAG-X64: {{.*}}