From 7f98cac93acfd4ed42fb4283443cfb27b6693ca1 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 26 Jun 2009 22:37:07 +0000 Subject: [PATCH] Thumb-2 tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74345 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/Thumb2/thumb2-add2.ll | 4 +--- test/CodeGen/Thumb2/thumb2-add3.ll | 4 +--- test/CodeGen/Thumb2/thumb2-add4.ll | 4 +--- test/CodeGen/Thumb2/thumb2-and.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-and2.ll | 31 ++++++++++++++++++++++++++++++ test/CodeGen/Thumb2/thumb2-asr.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-asr2.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-bfc.ll | 19 ++++++++++++++++++ test/CodeGen/Thumb2/thumb2-bic2.ll | 25 ++++++++++++++++++++++++ test/CodeGen/Thumb2/thumb2-cmn2.ll | 25 ++++++++++++++++++++++++ test/CodeGen/Thumb2/thumb2-eor.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-eor2.ll | 31 ++++++++++++++++++++++++++++++ test/CodeGen/Thumb2/thumb2-lsl.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-lsl2.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-lsr.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-lsr2.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-mov3.ll | 4 +--- test/CodeGen/Thumb2/thumb2-mov4.ll | 4 +--- test/CodeGen/Thumb2/thumb2-mul.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-neg.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-orn2.ll | 29 ++++++++++++++++++++++++++++ test/CodeGen/Thumb2/thumb2-orr.ll | 6 ++++++ test/CodeGen/Thumb2/thumb2-orr2.ll | 31 ++++++++++++++++++++++++++++++ test/CodeGen/Thumb2/thumb2-rev.ll | 8 ++++++++ test/CodeGen/Thumb2/thumb2-ror.ll | 8 ++++++++ test/CodeGen/Thumb2/thumb2-ror2.ll | 9 +++++++++ test/CodeGen/Thumb2/thumb2-rsb2.ll | 31 ++++++++++++++++++++++++++++++ 27 files changed, 318 insertions(+), 15 deletions(-) create mode 100644 test/CodeGen/Thumb2/thumb2-and.ll create mode 100644 test/CodeGen/Thumb2/thumb2-and2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-asr.ll create mode 100644 test/CodeGen/Thumb2/thumb2-asr2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-bfc.ll create mode 100644 test/CodeGen/Thumb2/thumb2-bic2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-cmn2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-eor.ll create mode 100644 test/CodeGen/Thumb2/thumb2-eor2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-lsl.ll create mode 100644 test/CodeGen/Thumb2/thumb2-lsl2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-lsr.ll create mode 100644 test/CodeGen/Thumb2/thumb2-lsr2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-mul.ll create mode 100644 test/CodeGen/Thumb2/thumb2-neg.ll create mode 100644 test/CodeGen/Thumb2/thumb2-orn2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-orr.ll create mode 100644 test/CodeGen/Thumb2/thumb2-orr2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-rev.ll create mode 100644 test/CodeGen/Thumb2/thumb2-ror.ll create mode 100644 test/CodeGen/Thumb2/thumb2-ror2.ll create mode 100644 test/CodeGen/Thumb2/thumb2-rsb2.ll diff --git a/test/CodeGen/Thumb2/thumb2-add2.ll b/test/CodeGen/Thumb2/thumb2-add2.ll index e76650c688e..f94b3c166d8 100644 --- a/test/CodeGen/Thumb2/thumb2-add2.ll +++ b/test/CodeGen/Thumb2/thumb2-add2.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as < %s | llc | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 - -target triple = "thumbv7-apple-darwin" +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 ; 171 = 0x000000ab define i32 @f1(i32 %a) { diff --git a/test/CodeGen/Thumb2/thumb2-add3.ll b/test/CodeGen/Thumb2/thumb2-add3.ll index abe15a3f5dd..1e6341e882f 100644 --- a/test/CodeGen/Thumb2/thumb2-add3.ll +++ b/test/CodeGen/Thumb2/thumb2-add3.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as < %s | llc | grep {addw\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#4095} | count 1 - -target triple = "thumbv7-apple-darwin" +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {addw\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#4095} | count 1 define i32 @f1(i32 %a) { %tmp = add i32 %a, 4095 diff --git a/test/CodeGen/Thumb2/thumb2-add4.ll b/test/CodeGen/Thumb2/thumb2-add4.ll index 01d59385131..b74a33c90a1 100644 --- a/test/CodeGen/Thumb2/thumb2-add4.ll +++ b/test/CodeGen/Thumb2/thumb2-add4.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as < %s | llc | grep {adds\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 - -target triple = "thumbv7-apple-darwin" +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adds\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 ; 171 = 0x000000ab define i64 @f1(i64 %a) { diff --git a/test/CodeGen/Thumb2/thumb2-and.ll b/test/CodeGen/Thumb2/thumb2-and.ll new file mode 100644 index 00000000000..360c977f45e --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-and.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp = and i32 %a, %b + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-and2.ll b/test/CodeGen/Thumb2/thumb2-and2.ll new file mode 100644 index 00000000000..266d256fce5 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-and2.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 + +; 171 = 0x000000ab +define i32 @f1(i32 %a) { + %tmp = and i32 %a, 171 + ret i32 %tmp +} + +; 1179666 = 0x00120012 +define i32 @f2(i32 %a) { + %tmp = and i32 %a, 1179666 + ret i32 %tmp +} + +; 872428544 = 0x34003400 +define i32 @f3(i32 %a) { + %tmp = and i32 %a, 872428544 + ret i32 %tmp +} + +; 1448498774 = 0x56565656 +define i32 @f4(i32 %a) { + %tmp = and i32 %a, 1448498774 + ret i32 %tmp +} + +; 66846720 = 0x03fc0000 +define i32 @f5(i32 %a) { + %tmp = and i32 %a, 66846720 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-asr.ll b/test/CodeGen/Thumb2/thumb2-asr.ll new file mode 100644 index 00000000000..4edf92be133 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-asr.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {asr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp = ashr i32 %a, %b + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-asr2.ll b/test/CodeGen/Thumb2/thumb2-asr2.ll new file mode 100644 index 00000000000..700794873f3 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-asr2.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {asr\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#17} | count 1 + +define i32 @f1(i32 %a) { + %tmp = ashr i32 %a, 17 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-bfc.ll b/test/CodeGen/Thumb2/thumb2-bfc.ll new file mode 100644 index 00000000000..1e5016c9129 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-bfc.ll @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "bfc " | count 3 + +; 4278190095 = 0xff00000f +define i32 @f1(i32 %a) { + %tmp = and i32 %a, 4278190095 + ret i32 %tmp +} + +; 4286578688 = 0xff800000 +define i32 @f2(i32 %a) { + %tmp = and i32 %a, 4286578688 + ret i32 %tmp +} + +; 4095 = 0x00000fff +define i32 @f3(i32 %a) { + %tmp = and i32 %a, 4095 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-bic2.ll b/test/CodeGen/Thumb2/thumb2-bic2.ll new file mode 100644 index 00000000000..b8abdba187d --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-bic2.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "bic " | grep {#187\\|#11141290\\|#3422604288\\|#1114112} | count 4 + +; ~0x000000bb = 4294967108 +define i32 @f1(i32 %a) { + %tmp = and i32 %a, 4294967108 + ret i32 %tmp +} + +; ~0x00aa00aa = 4283826005 +define i32 @f2(i32 %a) { + %tmp = and i32 %a, 4283826005 + ret i32 %tmp +} + +; ~0xcc00cc00 = 872363007 +define i32 @f3(i32 %a) { + %tmp = and i32 %a, 872363007 + ret i32 %tmp +} + +; ~0x00110000 = 4293853183 +define i32 @f4(i32 %a) { + %tmp = and i32 %a, 4293853183 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-cmn2.ll b/test/CodeGen/Thumb2/thumb2-cmn2.ll new file mode 100644 index 00000000000..9763dea045c --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-cmn2.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "cmn " | grep {#187\\|#11141290\\|#3422604288\\|#1114112} | count 4 + +; -0x000000bb = 4294967109 +define i1 @f1(i32 %a) { + %tmp = icmp ne i32 %a, 4294967109 + ret i1 %tmp +} + +; -0x00aa00aa = 4283826006 +define i1 @f2(i32 %a) { + %tmp = icmp eq i32 %a, 4283826006 + ret i1 %tmp +} + +; -0xcc00cc00 = 872363008 +define i1 @f3(i32 %a) { + %tmp = icmp ne i32 %a, 872363008 + ret i1 %tmp +} + +; -0x00110000 = 4293853184 +define i1 @f4(i32 %a) { + %tmp = icmp eq i32 %a, 4293853184 + ret i1 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-eor.ll b/test/CodeGen/Thumb2/thumb2-eor.ll new file mode 100644 index 00000000000..ec98f645d6c --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-eor.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp = xor i32 %a, %b + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-eor2.ll b/test/CodeGen/Thumb2/thumb2-eor2.ll new file mode 100644 index 00000000000..11784ca02c1 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-eor2.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "eor " | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 5 + +; 0x000000bb = 187 +define i32 @f1(i32 %a) { + %tmp = xor i32 %a, 187 + ret i32 %tmp +} + +; 0x00aa00aa = 11141290 +define i32 @f2(i32 %a) { + %tmp = xor i32 %a, 11141290 + ret i32 %tmp +} + +; 0xcc00cc00 = 3422604288 +define i32 @f3(i32 %a) { + %tmp = xor i32 %a, 3422604288 + ret i32 %tmp +} + +; 0xdddddddd = 3722304989 +define i32 @f4(i32 %a) { + %tmp = xor i32 %a, 3722304989 + ret i32 %tmp +} + +; 0x00110000 = 1114112 +define i32 @f5(i32 %a) { + %tmp = xor i32 %a, 1114112 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-lsl.ll b/test/CodeGen/Thumb2/thumb2-lsl.ll new file mode 100644 index 00000000000..666963a4b49 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-lsl.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsl\\W*r\[0-9\],\\W*r\[0-9\],\\W*\[0-9\]} | count 1 + +define i32 @f1(i32 %a) { + %tmp = shl i32 %a, 5 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-lsl2.ll b/test/CodeGen/Thumb2/thumb2-lsl2.ll new file mode 100644 index 00000000000..eb7a2795343 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-lsl2.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsl\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp = shl i32 %a, %b + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-lsr.ll b/test/CodeGen/Thumb2/thumb2-lsr.ll new file mode 100644 index 00000000000..cf4d2f81c55 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-lsr.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsr\\W*r\[0-9\],\\W*r\[0-9\],\\W*\[0-9\]} | count 1 + +define i32 @f1(i32 %a) { + %tmp = lshr i32 %a, 13 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-lsr2.ll b/test/CodeGen/Thumb2/thumb2-lsr2.ll new file mode 100644 index 00000000000..01fd56d52c1 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-lsr2.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp = lshr i32 %a, %b + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-mov3.ll b/test/CodeGen/Thumb2/thumb2-mov3.ll index 20007c2bb6f..74418c1000c 100644 --- a/test/CodeGen/Thumb2/thumb2-mov3.ll +++ b/test/CodeGen/Thumb2/thumb2-mov3.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as < %s | llc | grep {mov\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 - -target triple = "thumbv7-apple-darwin" +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mov\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 ; 171 = 0x000000ab define i32 @f1(i32 %a) { diff --git a/test/CodeGen/Thumb2/thumb2-mov4.ll b/test/CodeGen/Thumb2/thumb2-mov4.ll index f1abb813a10..74c522f94f0 100644 --- a/test/CodeGen/Thumb2/thumb2-mov4.ll +++ b/test/CodeGen/Thumb2/thumb2-mov4.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as < %s | llc | grep {movw\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#65535} | count 1 - -target triple = "thumbv7-apple-darwin" +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {movw\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#65535} | count 1 define i32 @f6(i32 %a) { %tmp = add i32 0, 65535 diff --git a/test/CodeGen/Thumb2/thumb2-mul.ll b/test/CodeGen/Thumb2/thumb2-mul.ll new file mode 100644 index 00000000000..e976e66c001 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-mul.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mul\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 + +define i32 @f1(i32 %a, i32 %b, i32 %c) { + %tmp = mul i32 %a, %b + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-neg.ll b/test/CodeGen/Thumb2/thumb2-neg.ll new file mode 100644 index 00000000000..8f938d579b8 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-neg.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*#0} | count 1 + +define i32 @f1(i32 %a) { + %tmp = sub i32 0, %a + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-orn2.ll b/test/CodeGen/Thumb2/thumb2-orn2.ll new file mode 100644 index 00000000000..7758edd1d69 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-orn2.ll @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112} | count 4 + +; 0x000000bb = 187 +define i32 @f1(i32 %a) { + %tmp1 = xor i32 4294967295, 187 + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} + +; 0x00aa00aa = 11141290 +define i32 @f2(i32 %a) { + %tmp1 = xor i32 4294967295, 11141290 + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} + +; 0xcc00cc00 = 3422604288 +define i32 @f3(i32 %a) { + %tmp1 = xor i32 4294967295, 3422604288 + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} + +; 0x00110000 = 1114112 +define i32 @f5(i32 %a) { + %tmp1 = xor i32 4294967295, 1114112 + %tmp2 = or i32 %a, %tmp1 + ret i32 %tmp2 +} diff --git a/test/CodeGen/Thumb2/thumb2-orr.ll b/test/CodeGen/Thumb2/thumb2-orr.ll new file mode 100644 index 00000000000..922294638c2 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-orr.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %tmp2 = or i32 %a, %b + ret i32 %tmp2 +} diff --git a/test/CodeGen/Thumb2/thumb2-orr2.ll b/test/CodeGen/Thumb2/thumb2-orr2.ll new file mode 100644 index 00000000000..6f2b62c00c6 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-orr2.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1145324612\\|#1114112} | count 5 + +; 0x000000bb = 187 +define i32 @f1(i32 %a) { + %tmp2 = or i32 %a, 187 + ret i32 %tmp2 +} + +; 0x00aa00aa = 11141290 +define i32 @f2(i32 %a) { + %tmp2 = or i32 %a, 11141290 + ret i32 %tmp2 +} + +; 0xcc00cc00 = 3422604288 +define i32 @f3(i32 %a) { + %tmp2 = or i32 %a, 3422604288 + ret i32 %tmp2 +} + +; 0x44444444 = 1145324612 +define i32 @f4(i32 %a) { + %tmp2 = or i32 %a, 1145324612 + ret i32 %tmp2 +} + +; 0x00110000 = 1114112 +define i32 @f5(i32 %a) { + %tmp2 = or i32 %a, 1114112 + ret i32 %tmp2 +} diff --git a/test/CodeGen/Thumb2/thumb2-rev.ll b/test/CodeGen/Thumb2/thumb2-rev.ll new file mode 100644 index 00000000000..4009da33b26 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-rev.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2,+v7a | grep {rev\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 + +define i32 @f1(i32 %a) { + %tmp = tail call i32 @llvm.bswap.i32(i32 %a) + ret i32 %tmp +} + +declare i32 @llvm.bswap.i32(i32) nounwind readnone diff --git a/test/CodeGen/Thumb2/thumb2-ror.ll b/test/CodeGen/Thumb2/thumb2-ror.ll new file mode 100644 index 00000000000..305ab994518 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-ror.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ror\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep 22 | count 1 + +define i32 @f1(i32 %a) { + %l8 = shl i32 %a, 10 + %r8 = lshr i32 %a, 22 + %tmp = or i32 %l8, %r8 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-ror2.ll b/test/CodeGen/Thumb2/thumb2-ror2.ll new file mode 100644 index 00000000000..dd19b0afb18 --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-ror2.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ror\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 + +define i32 @f1(i32 %a, i32 %b) { + %db = sub i32 32, %b + %l8 = shl i32 %a, %b + %r8 = lshr i32 %a, %db + %tmp = or i32 %l8, %r8 + ret i32 %tmp +} diff --git a/test/CodeGen/Thumb2/thumb2-rsb2.ll b/test/CodeGen/Thumb2/thumb2-rsb2.ll new file mode 100644 index 00000000000..957d1d0717e --- /dev/null +++ b/test/CodeGen/Thumb2/thumb2-rsb2.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 + +; 171 = 0x000000ab +define i32 @f1(i32 %a) { + %tmp = sub i32 171, %a + ret i32 %tmp +} + +; 1179666 = 0x00120012 +define i32 @f2(i32 %a) { + %tmp = sub i32 1179666, %a + ret i32 %tmp +} + +; 872428544 = 0x34003400 +define i32 @f3(i32 %a) { + %tmp = sub i32 872428544, %a + ret i32 %tmp +} + +; 1448498774 = 0x56565656 +define i32 @f4(i32 %a) { + %tmp = sub i32 1448498774, %a + ret i32 %tmp +} + +; 66846720 = 0x03fc0000 +define i32 @f5(i32 %a) { + %tmp = sub i32 66846720, %a + ret i32 %tmp +} -- 2.34.1