From 60abcb786e8ff401e7d925d717e725d4a3d925b5 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Sun, 19 May 2013 20:38:21 +0000 Subject: [PATCH] Select i64 values with %icc conditions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182224 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcInstr64Bit.td | 5 +++++ test/CodeGen/SPARC/64cond.ll | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/Target/Sparc/SparcInstr64Bit.td b/lib/Target/Sparc/SparcInstr64Bit.td index 129b316d33d..3af494ee0c7 100644 --- a/lib/Target/Sparc/SparcInstr64Bit.td +++ b/lib/Target/Sparc/SparcInstr64Bit.td @@ -340,6 +340,11 @@ def : Pat<(SPselectxcc i64:$t, i64:$f, imm:$cond), def : Pat<(SPselectxcc (i64 simm11:$t), i64:$f, imm:$cond), (MOVXCCri (as_i32imm $t), $f, imm:$cond)>; +def : Pat<(SPselecticc i64:$t, i64:$f, imm:$cond), + (MOVICCrr $t, $f, imm:$cond)>; +def : Pat<(SPselecticc (i64 simm11:$t), i64:$f, imm:$cond), + (MOVICCri (as_i32imm $t), $f, imm:$cond)>; + def : Pat<(SPselectfcc i64:$t, i64:$f, imm:$cond), (MOVFCCrr $t, $f, imm:$cond)>; def : Pat<(SPselectfcc (i64 simm11:$t), i64:$f, imm:$cond), diff --git a/test/CodeGen/SPARC/64cond.ll b/test/CodeGen/SPARC/64cond.ll index c19da23766a..0c025b36e3b 100644 --- a/test/CodeGen/SPARC/64cond.ll +++ b/test/CodeGen/SPARC/64cond.ll @@ -55,6 +55,17 @@ entry: ret i64 %rv } +; CHECK: selecti64_icc +; CHECK: subcc %i0, %i1 +; CHECK: movg %icc, %i2, %i3 +; CHECK: or %g0, %i3, %i0 +define i64 @selecti64_icc(i32 %x, i32 %y, i64 %a, i64 %b) { +entry: + %tobool = icmp sgt i32 %x, %y + %rv = select i1 %tobool, i64 %a, i64 %b + ret i64 %rv +} + ; CHECK: selecti64_fcc ; CHECK: fcmps %f1, %f3 ; CHECK: movul %fcc0, %i2, %i3 -- 2.11.0