From bf34f346420dbcdb3f9376967bde701682471a79 Mon Sep 17 00:00:00 2001 From: Venkatraman Govindaraju Date: Wed, 4 Sep 2013 15:15:20 +0000 Subject: [PATCH] [Sparc] Fix an assertion failure while lowering fcmp on long double. This assertion is triggered because an integer constant is created with wrong type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189948 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcISelLowering.cpp | 2 +- test/CodeGen/SPARC/fp128.ll | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp index 3250537d0b0..e646521f60f 100644 --- a/lib/Target/Sparc/SparcISelLowering.cpp +++ b/lib/Target/Sparc/SparcISelLowering.cpp @@ -1816,7 +1816,7 @@ SparcTargetLowering::LowerF128Compare(SDValue LHS, SDValue RHS, return DAG.getNode(SPISD::CMPICC, DL, MVT::Glue, Result, RHS); } case SPCC::FCC_ULE: { - SDValue RHS = DAG.getTargetConstant(2, LHS.getValueType()); + SDValue RHS = DAG.getTargetConstant(2, Result.getValueType()); SPCC = SPCC::ICC_NE; return DAG.getNode(SPISD::CMPICC, DL, MVT::Glue, Result, RHS); } diff --git a/test/CodeGen/SPARC/fp128.ll b/test/CodeGen/SPARC/fp128.ll index 31ce6059f61..153819974b6 100644 --- a/test/CodeGen/SPARC/fp128.ll +++ b/test/CodeGen/SPARC/fp128.ll @@ -76,3 +76,23 @@ entry: %ret = select i1 %cond, i32 %a, i32 %b ret i32 %ret } + +; HARD-LABEL: f128_compare2 +; HARD: fcmpq +; HARD: fb{{ule|g}} + +; SOFT-LABEL: f128_compare2 +; SOFT: _Q_cmp +; SOFT: cmp + +define i32 @f128_compare2() { +entry: + %0 = fcmp ogt fp128 undef, 0xL00000000000000000000000000000000 + br i1 %0, label %"5", label %"7" + +"5": ; preds = %entry + ret i32 0 + +"7": ; preds = %entry + ret i32 1 +} -- 2.34.1