diff options
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/SystemZ/strlen-01.ll | 39 | ||||
| -rw-r--r-- | llvm/test/CodeGen/SystemZ/strlen-02.ll | 39 | ||||
| -rw-r--r-- | llvm/test/MC/Disassembler/SystemZ/insns.txt | 12 | ||||
| -rw-r--r-- | llvm/test/MC/SystemZ/insn-good.s | 10 |
4 files changed, 100 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/strlen-01.ll b/llvm/test/CodeGen/SystemZ/strlen-01.ll new file mode 100644 index 00000000000..16161d4d2c8 --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/strlen-01.ll @@ -0,0 +1,39 @@ +; Test strlen using SRST, i64 version. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s + +declare i64 @strlen(i8 *%src) +declare i64 @strnlen(i8 *%src, i64 %len) + +; Test strlen with its proper i64 prototype. It would also be valid for +; the uses of %r3 and REG after the LGR to be swapped. +define i64 @f1(i32 %dummy, i8 *%src) { +; CHECK-LABEL: f1: +; CHECK-DAG: lhi %r0, 0 +; CHECK-DAG: lghi %r2, 0 +; CHECK-DAG: lgr [[REG:%r[145]]], %r3 +; CHECK: [[LABEL:\.[^:]*]]: +; CHECK-NEXT: srst %r2, [[REG]] +; CHECK-NEXT: jo [[LABEL]] +; CHECK-NEXT: BB#{{[0-9]+}} +; CHECK-NEXT: sgr %r2, %r3 +; CHECK: br %r14 + %res = call i64 @strlen(i8 *%src) + ret i64 %res +} + +; Test strnlen with its proper i64 prototype. +define i64 @f2(i64 %len, i8 *%src) { +; CHECK-LABEL: f2: +; CHECK-DAG: agr %r2, %r3 +; CHECK-DAG: lhi %r0, 0 +; CHECK-DAG: lgr [[REG:%r[145]]], %r3 +; CHECK: [[LABEL:\.[^:]*]]: +; CHECK-NEXT: srst %r2, [[REG]] +; CHECK-NEXT: jo [[LABEL]] +; CHECK-NEXT: BB#{{[0-9]+}} +; CHECK-NEXT: sgr %r2, %r3 +; CHECK: br %r14 + %res = call i64 @strnlen(i8 *%src, i64 %len) + ret i64 %res +} diff --git a/llvm/test/CodeGen/SystemZ/strlen-02.ll b/llvm/test/CodeGen/SystemZ/strlen-02.ll new file mode 100644 index 00000000000..e1abbff4b4e --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/strlen-02.ll @@ -0,0 +1,39 @@ +; Test strlen using SRST, i32 version. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s + +declare i32 @strlen(i8 *%src) +declare i32 @strnlen(i8 *%src, i32 %len) + +; Test strlen with an i32-based prototype. It would also be valid for +; the uses of %r3 and REG after the LGR to be swapped. +define i32 @f1(i32 %dummy, i8 *%src) { +; CHECK-LABEL: f1: +; CHECK-DAG: lhi %r0, 0 +; CHECK-DAG: lghi %r2, 0 +; CHECK-DAG: lgr [[REG:%r[145]]], %r3 +; CHECK: [[LABEL:\.[^:]*]]: +; CHECK-NEXT: srst %r2, [[REG]] +; CHECK-NEXT: jo [[LABEL]] +; CHECK-NEXT: BB#{{[0-9]+}} +; CHECK-NEXT: sgr %r2, %r3 +; CHECK: br %r14 + %res = call i32 @strlen(i8 *%src) + ret i32 %res +} + +; Test strnlen with an i32-based prototype. +define i32 @f2(i32 zeroext %len, i8 *%src) { +; CHECK-LABEL: f2: +; CHECK-DAG: agr %r2, %r3 +; CHECK-DAG: lhi %r0, 0 +; CHECK-DAG: lgr [[REG:%r[145]]], %r3 +; CHECK: [[LABEL:\.[^:]*]]: +; CHECK-NEXT: srst %r2, [[REG]] +; CHECK-NEXT: jo [[LABEL]] +; CHECK-NEXT: BB#{{[0-9]+}} +; CHECK-NEXT: sgr %r2, %r3 +; CHECK: br %r14 + %res = call i32 @strnlen(i8 *%src, i32 %len) + ret i32 %res +} diff --git a/llvm/test/MC/Disassembler/SystemZ/insns.txt b/llvm/test/MC/Disassembler/SystemZ/insns.txt index c25bb9f9461..328e2d63d43 100644 --- a/llvm/test/MC/Disassembler/SystemZ/insns.txt +++ b/llvm/test/MC/Disassembler/SystemZ/insns.txt @@ -6253,6 +6253,18 @@ # CHECK: srk %r2, %r3, %r4 0xb9 0xf9 0x40 0x23 +# CHECK: srst %r0, %r0 +0xb2 0x5e 0x00 0x00 + +# CHECK: srst %r0, %r15 +0xb2 0x5e 0x00 0x0f + +# CHECK: srst %r15, %r0 +0xb2 0x5e 0x00 0xf0 + +# CHECK: srst %r7, %r8 +0xb2 0x5e 0x00 0x78 + # CHECK: stc %r0, 0 0x42 0x00 0x00 0x00 diff --git a/llvm/test/MC/SystemZ/insn-good.s b/llvm/test/MC/SystemZ/insn-good.s index da2b77e4eb7..52dc31d9dff 100644 --- a/llvm/test/MC/SystemZ/insn-good.s +++ b/llvm/test/MC/SystemZ/insn-good.s @@ -6728,6 +6728,16 @@ srlg %r0,%r0,524287(%r1) srlg %r0,%r0,524287(%r15) +#CHECK: srst %r0, %r0 # encoding: [0xb2,0x5e,0x00,0x00] +#CHECK: srst %r0, %r15 # encoding: [0xb2,0x5e,0x00,0x0f] +#CHECK: srst %r15, %r0 # encoding: [0xb2,0x5e,0x00,0xf0] +#CHECK: srst %r7, %r8 # encoding: [0xb2,0x5e,0x00,0x78] + + srst %r0,%r0 + srst %r0,%r15 + srst %r15,%r0 + srst %r7,%r8 + #CHECK: st %r0, 0 # encoding: [0x50,0x00,0x00,0x00] #CHECK: st %r0, 4095 # encoding: [0x50,0x00,0x0f,0xff] #CHECK: st %r0, 0(%r1) # encoding: [0x50,0x00,0x10,0x00] |

