summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-10-01 15:00:44 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-10-01 15:00:44 +0000
commite22c56d6d81b84d6f4ba24c2f5b0b203e7ddffe9 (patch)
tree2cb11c268f8f3373416cf3fc1400a62ba4701ba3 /test
parent185ef05ad6fdcaad1e831020b1f88d0046dd15d6 (diff)
downloadllvm-e22c56d6d81b84d6f4ba24c2f5b0b203e7ddffe9.tar.gz
llvm-e22c56d6d81b84d6f4ba24c2f5b0b203e7ddffe9.tar.bz2
llvm-e22c56d6d81b84d6f4ba24c2f5b0b203e7ddffe9.tar.xz
[SystemZ] Add comparisons of high words and memory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/SystemZ/asm-18.ll40
-rw-r--r--test/MC/Disassembler/SystemZ/insns.txt60
-rw-r--r--test/MC/SystemZ/insn-bad-z196.s16
-rw-r--r--test/MC/SystemZ/insn-bad.s10
-rw-r--r--test/MC/SystemZ/insn-good-z196.s44
5 files changed, 170 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/asm-18.ll b/test/CodeGen/SystemZ/asm-18.ll
index d39de6d655..d60654b786 100644
--- a/test/CodeGen/SystemZ/asm-18.ll
+++ b/test/CodeGen/SystemZ/asm-18.ll
@@ -703,3 +703,43 @@ define i32 @f32() {
%sel2 = select i1 %cmp2, i32 0, i32 1
ret i32 %sel2
}
+
+; Test memory comparison involving high registers.
+define void @f33(i32 *%ptr1, i32 *%ptr2) {
+; CHECK-LABEL: f33:
+; CHECK: stepa [[REG1:%r[0-5]]]
+; CHECK: chf [[REG1]], 0(%r2)
+; CHECK: stepb [[REG2:%r[0-5]]]
+; CHECK: clhf [[REG2]], 0(%r3)
+; CHECK: br %r14
+ %res1 = call i32 asm "stepa $0", "=h"()
+ %load1 = load i32 *%ptr1
+ %cmp1 = icmp sle i32 %res1, %load1
+ %sel1 = select i1 %cmp1, i32 0, i32 1
+ %res2 = call i32 asm "stepb $0, $1", "=h,r"(i32 %sel1)
+ %load2 = load i32 *%ptr2
+ %cmp2 = icmp ule i32 %res2, %load2
+ %sel2 = select i1 %cmp2, i32 0, i32 1
+ store i32 %sel2, i32 *%ptr1
+ ret void
+}
+
+; Test memory comparison involving low registers.
+define void @f34(i32 *%ptr1, i32 *%ptr2) {
+; CHECK-LABEL: f34:
+; CHECK: stepa [[REG1:%r[0-5]]]
+; CHECK: c [[REG1]], 0(%r2)
+; CHECK: stepb [[REG2:%r[0-5]]]
+; CHECK: cl [[REG2]], 0(%r3)
+; CHECK: br %r14
+ %res1 = call i32 asm "stepa $0", "=r"()
+ %load1 = load i32 *%ptr1
+ %cmp1 = icmp sle i32 %res1, %load1
+ %sel1 = select i1 %cmp1, i32 0, i32 1
+ %res2 = call i32 asm "stepb $0, $1", "=r,r"(i32 %sel1)
+ %load2 = load i32 *%ptr2
+ %cmp2 = icmp ule i32 %res2, %load2
+ %sel2 = select i1 %cmp2, i32 0, i32 1
+ store i32 %sel2, i32 *%ptr1
+ ret void
+}
diff --git a/test/MC/Disassembler/SystemZ/insns.txt b/test/MC/Disassembler/SystemZ/insns.txt
index f88531b2cd..982b35ffad 100644
--- a/test/MC/Disassembler/SystemZ/insns.txt
+++ b/test/MC/Disassembler/SystemZ/insns.txt
@@ -1216,6 +1216,36 @@
# CHECK: cgxbr %r15, 0, %f0
0xb3 0xaa 0x00 0xf0
+# CHECK: chf %r0, -524288
+0xe3 0x00 0x00 0x00 0x80 0xcd
+
+# CHECK: chf %r0, -1
+0xe3 0x00 0x0f 0xff 0xff 0xcd
+
+# CHECK: chf %r0, 0
+0xe3 0x00 0x00 0x00 0x00 0xcd
+
+# CHECK: chf %r0, 1
+0xe3 0x00 0x00 0x01 0x00 0xcd
+
+# CHECK: chf %r0, 524287
+0xe3 0x00 0x0f 0xff 0x7f 0xcd
+
+# CHECK: chf %r0, 0(%r1)
+0xe3 0x00 0x10 0x00 0x00 0xcd
+
+# CHECK: chf %r0, 0(%r15)
+0xe3 0x00 0xf0 0x00 0x00 0xcd
+
+# CHECK: chf %r0, 524287(%r1,%r15)
+0xe3 0x01 0xff 0xff 0x7f 0xcd
+
+# CHECK: chf %r0, 524287(%r15,%r1)
+0xe3 0x0f 0x1f 0xff 0x7f 0xcd
+
+# CHECK: chf %r15, 0
+0xe3 0xf0 0x00 0x00 0x00 0xcd
+
# CHECK: chhsi 0, 0
0xe5 0x54 0x00 0x00 0x00 0x00
@@ -1549,6 +1579,36 @@
# CHECK: clg %r15, 0
0xe3 0xf0 0x00 0x00 0x00 0x21
+# CHECK: clhf %r0, -524288
+0xe3 0x00 0x00 0x00 0x80 0xcf
+
+# CHECK: clhf %r0, -1
+0xe3 0x00 0x0f 0xff 0xff 0xcf
+
+# CHECK: clhf %r0, 0
+0xe3 0x00 0x00 0x00 0x00 0xcf
+
+# CHECK: clhf %r0, 1
+0xe3 0x00 0x00 0x01 0x00 0xcf
+
+# CHECK: clhf %r0, 524287
+0xe3 0x00 0x0f 0xff 0x7f 0xcf
+
+# CHECK: clhf %r0, 0(%r1)
+0xe3 0x00 0x10 0x00 0x00 0xcf
+
+# CHECK: clhf %r0, 0(%r15)
+0xe3 0x00 0xf0 0x00 0x00 0xcf
+
+# CHECK: clhf %r0, 524287(%r1,%r15)
+0xe3 0x01 0xff 0xff 0x7f 0xcf
+
+# CHECK: clhf %r0, 524287(%r15,%r1)
+0xe3 0x0f 0x1f 0xff 0x7f 0xcf
+
+# CHECK: clhf %r15, 0
+0xe3 0xf0 0x00 0x00 0x00 0xcf
+
# CHECK: clhhsi 0, 0
0xe5 0x55 0x00 0x00 0x00 0x00
diff --git a/test/MC/SystemZ/insn-bad-z196.s b/test/MC/SystemZ/insn-bad-z196.s
index e387f149fd..089d9b5b3e 100644
--- a/test/MC/SystemZ/insn-bad-z196.s
+++ b/test/MC/SystemZ/insn-bad-z196.s
@@ -33,6 +33,14 @@
aih %r0, (1 << 31)
#CHECK: error: invalid operand
+#CHECK: chf %r0, -524289
+#CHECK: error: invalid operand
+#CHECK: chf %r0, 524288
+
+ chf %r0, -524289
+ chf %r0, 524288
+
+#CHECK: error: invalid operand
#CHECK: cih %r0, (-1 << 31) - 1
#CHECK: error: invalid operand
#CHECK: cih %r0, (1 << 31)
@@ -41,6 +49,14 @@
cih %r0, (1 << 31)
#CHECK: error: invalid operand
+#CHECK: clhf %r0, -524289
+#CHECK: error: invalid operand
+#CHECK: clhf %r0, 524288
+
+ clhf %r0, -524289
+ clhf %r0, 524288
+
+#CHECK: error: invalid operand
#CHECK: clih %r0, -1
#CHECK: error: invalid operand
#CHECK: clih %r0, (1 << 32)
diff --git a/test/MC/SystemZ/insn-bad.s b/test/MC/SystemZ/insn-bad.s
index 8de20612ca..64453a5581 100644
--- a/test/MC/SystemZ/insn-bad.s
+++ b/test/MC/SystemZ/insn-bad.s
@@ -612,6 +612,11 @@
ch %r0, -1
ch %r0, 4096
+#CHECK: error: {{(instruction requires: high-word)?}}
+#CHECK: chf %r0, 0
+
+ chf %r0, 0
+
#CHECK: error: invalid operand
#CHECK: chhsi -1, 0
#CHECK: error: invalid operand
@@ -766,6 +771,11 @@
clc 0(1,%r2), 0(%r1,%r2)
clc 0(-), 0
+#CHECK: error: {{(instruction requires: high-word)?}}
+#CHECK: clhf %r0, 0
+
+ clhf %r0, 0
+
#CHECK: error: invalid operand
#CHECK: clfhsi -1, 0
#CHECK: error: invalid operand
diff --git a/test/MC/SystemZ/insn-good-z196.s b/test/MC/SystemZ/insn-good-z196.s
index 93687ea81f..258e06f99d 100644
--- a/test/MC/SystemZ/insn-good-z196.s
+++ b/test/MC/SystemZ/insn-good-z196.s
@@ -135,6 +135,28 @@
ark %r15,%r0,%r0
ark %r7,%r8,%r9
+#CHECK: chf %r0, -524288 # encoding: [0xe3,0x00,0x00,0x00,0x80,0xcd]
+#CHECK: chf %r0, -1 # encoding: [0xe3,0x00,0x0f,0xff,0xff,0xcd]
+#CHECK: chf %r0, 0 # encoding: [0xe3,0x00,0x00,0x00,0x00,0xcd]
+#CHECK: chf %r0, 1 # encoding: [0xe3,0x00,0x00,0x01,0x00,0xcd]
+#CHECK: chf %r0, 524287 # encoding: [0xe3,0x00,0x0f,0xff,0x7f,0xcd]
+#CHECK: chf %r0, 0(%r1) # encoding: [0xe3,0x00,0x10,0x00,0x00,0xcd]
+#CHECK: chf %r0, 0(%r15) # encoding: [0xe3,0x00,0xf0,0x00,0x00,0xcd]
+#CHECK: chf %r0, 524287(%r1,%r15) # encoding: [0xe3,0x01,0xff,0xff,0x7f,0xcd]
+#CHECK: chf %r0, 524287(%r15,%r1) # encoding: [0xe3,0x0f,0x1f,0xff,0x7f,0xcd]
+#CHECK: chf %r15, 0 # encoding: [0xe3,0xf0,0x00,0x00,0x00,0xcd]
+
+ chf %r0, -524288
+ chf %r0, -1
+ chf %r0, 0
+ chf %r0, 1
+ chf %r0, 524287
+ chf %r0, 0(%r1)
+ chf %r0, 0(%r15)
+ chf %r0, 524287(%r1,%r15)
+ chf %r0, 524287(%r15,%r1)
+ chf %r15, 0
+
#CHECK: cih %r0, -2147483648 # encoding: [0xcc,0x0d,0x80,0x00,0x00,0x00]
#CHECK: cih %r0, -1 # encoding: [0xcc,0x0d,0xff,0xff,0xff,0xff]
#CHECK: cih %r0, 0 # encoding: [0xcc,0x0d,0x00,0x00,0x00,0x00]
@@ -149,6 +171,28 @@
cih %r0, (1 << 31) - 1
cih %r15, 0
+#CHECK: clhf %r0, -524288 # encoding: [0xe3,0x00,0x00,0x00,0x80,0xcf]
+#CHECK: clhf %r0, -1 # encoding: [0xe3,0x00,0x0f,0xff,0xff,0xcf]
+#CHECK: clhf %r0, 0 # encoding: [0xe3,0x00,0x00,0x00,0x00,0xcf]
+#CHECK: clhf %r0, 1 # encoding: [0xe3,0x00,0x00,0x01,0x00,0xcf]
+#CHECK: clhf %r0, 524287 # encoding: [0xe3,0x00,0x0f,0xff,0x7f,0xcf]
+#CHECK: clhf %r0, 0(%r1) # encoding: [0xe3,0x00,0x10,0x00,0x00,0xcf]
+#CHECK: clhf %r0, 0(%r15) # encoding: [0xe3,0x00,0xf0,0x00,0x00,0xcf]
+#CHECK: clhf %r0, 524287(%r1,%r15) # encoding: [0xe3,0x01,0xff,0xff,0x7f,0xcf]
+#CHECK: clhf %r0, 524287(%r15,%r1) # encoding: [0xe3,0x0f,0x1f,0xff,0x7f,0xcf]
+#CHECK: clhf %r15, 0 # encoding: [0xe3,0xf0,0x00,0x00,0x00,0xcf]
+
+ clhf %r0, -524288
+ clhf %r0, -1
+ clhf %r0, 0
+ clhf %r0, 1
+ clhf %r0, 524287
+ clhf %r0, 0(%r1)
+ clhf %r0, 0(%r15)
+ clhf %r0, 524287(%r1,%r15)
+ clhf %r0, 524287(%r15,%r1)
+ clhf %r15, 0
+
#CHECK: clih %r0, 0 # encoding: [0xcc,0x0f,0x00,0x00,0x00,0x00]
#CHECK: clih %r0, 1 # encoding: [0xcc,0x0f,0x00,0x00,0x00,0x01]
#CHECK: clih %r0, 4294967295 # encoding: [0xcc,0x0f,0xff,0xff,0xff,0xff]