diff options
author | Venkatraman Govindaraju <venkatra@cs.wisc.edu> | 2013-10-06 02:11:10 +0000 |
---|---|---|
committer | Venkatraman Govindaraju <venkatra@cs.wisc.edu> | 2013-10-06 02:11:10 +0000 |
commit | bb0ec9840bf6fd06fed967d5e70bee1983971344 (patch) | |
tree | d620f0ab79d89a66ea2ca78ef08b8e3566d6352d | |
parent | 984fbe6c65e54fe3815b14619240eafb3024c9bd (diff) | |
download | external_llvm-bb0ec9840bf6fd06fed967d5e70bee1983971344.zip external_llvm-bb0ec9840bf6fd06fed967d5e70bee1983971344.tar.gz external_llvm-bb0ec9840bf6fd06fed967d5e70bee1983971344.tar.bz2 |
[Sparc] Use addxcc/subxcc for adde/sube instead of addx/subx.
addx/subx does not modify conditional codes whereas addxcc/subxx does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192053 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/Sparc/SparcInstrInfo.td | 8 | ||||
-rw-r--r-- | test/CodeGen/SPARC/2011-01-11-CC.ll | 39 |
2 files changed, 43 insertions, 4 deletions
diff --git a/lib/Target/Sparc/SparcInstrInfo.td b/lib/Target/Sparc/SparcInstrInfo.td index fcab5b3..470de70 100644 --- a/lib/Target/Sparc/SparcInstrInfo.td +++ b/lib/Target/Sparc/SparcInstrInfo.td @@ -504,13 +504,13 @@ def LEA_ADDri : F3_2<2, 0b000000, let Defs = [ICC] in defm ADDCC : F3_12<"addcc", 0b010000, addc>; -let Uses = [ICC] in - defm ADDX : F3_12<"addx", 0b001000, adde>; +let Uses = [ICC], Defs = [ICC] in + defm ADDX : F3_12<"addxcc", 0b001000, adde>; // Section B.15 - Subtract Instructions, p. 110 defm SUB : F3_12 <"sub" , 0b000100, sub>; -let Uses = [ICC] in - defm SUBX : F3_12 <"subx" , 0b001100, sube>; +let Uses = [ICC], Defs = [ICC] in + defm SUBX : F3_12 <"subxcc" , 0b001100, sube>; let Defs = [ICC] in defm SUBCC : F3_12 <"subcc", 0b010100, subc>; diff --git a/test/CodeGen/SPARC/2011-01-11-CC.ll b/test/CodeGen/SPARC/2011-01-11-CC.ll index ba90ca1..30f7134 100644 --- a/test/CodeGen/SPARC/2011-01-11-CC.ll +++ b/test/CodeGen/SPARC/2011-01-11-CC.ll @@ -135,3 +135,42 @@ exit.0: exit.1: ret i32 1 } + +; V8-LABEL: test_adde_sube +; V8: addcc +; V8: addxcc +; V8: addxcc +; V8: addxcc +; V8: subcc +; V8: subxcc +; V8: subxcc +; V8: subxcc + + +; V9-LABEL: test_adde_sube +; V9: addcc +; V9: addxcc +; V9: addxcc +; V9: addxcc +; V9: subcc +; V9: subxcc +; V9: subxcc +; V9: subxcc + + +define void @test_adde_sube(i8* %a, i8* %b, i8* %sum, i8* %diff) { +entry: + %0 = bitcast i8* %a to i128* + %1 = bitcast i8* %b to i128* + %2 = load i128* %0 + %3 = load i128* %1 + %4 = add i128 %2, %3 + %5 = bitcast i8* %sum to i128* + store i128 %4, i128* %5 + tail call void asm sideeffect "", "=*m,*m"(i128 *%0, i128* %5) nounwind + %6 = load i128* %0 + %7 = sub i128 %2, %6 + %8 = bitcast i8* %diff to i128* + store i128 %7, i128* %8 + ret void +} |