• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2
3
4target datalayout = "E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-a0:16:16"
5target triple = "s390x-ibm-linux"
6
7
8define zeroext i16 @foo(i16 zeroext %a)  {
9	%res = tail call i16 @llvm.bswap.i16(i16 %a)
10	ret i16 %res
11}
12
13define zeroext i32 @foo2(i32 zeroext %a)  {
14; CHECK: foo2:
15; CHECK:  lrvr [[R1:%r.]], %r2
16        %res = tail call i32 @llvm.bswap.i32(i32 %a)
17        ret i32 %res
18}
19
20define zeroext i64 @foo3(i64 %a)  {
21; CHECK: foo3:
22; CHECK:  lrvgr %r2, %r2
23        %res = tail call i64 @llvm.bswap.i64(i64 %a)
24        ret i64 %res
25}
26
27define zeroext i16 @foo4(i16* %b)  {
28	%a = load i16* %b
29        %res = tail call i16 @llvm.bswap.i16(i16 %a)
30        ret i16 %res
31}
32
33define zeroext i32 @foo5(i32* %b)  {
34; CHECK: foo5:
35; CHECK:  lrv [[R1:%r.]], 0(%r2)
36	%a = load i32* %b
37        %res = tail call i32 @llvm.bswap.i32(i32 %a)
38        ret i32 %res
39}
40
41define i64 @foo6(i64* %b) {
42; CHECK: foo6:
43; CHECK:  lrvg %r2, 0(%r2)
44	%a = load i64* %b
45        %res = tail call i64 @llvm.bswap.i64(i64 %a)
46        ret i64 %res
47}
48
49define void @foo7(i16 %a, i16* %b) {
50        %res = tail call i16 @llvm.bswap.i16(i16 %a)
51        store i16 %res, i16* %b
52        ret void
53}
54
55define void @foo8(i32 %a, i32* %b) {
56; CHECK: foo8:
57; CHECK:  strv %r2, 0(%r3)
58        %res = tail call i32 @llvm.bswap.i32(i32 %a)
59        store i32 %res, i32* %b
60        ret void
61}
62
63define void @foo9(i64 %a, i64* %b) {
64; CHECK: foo9:
65; CHECK:  strvg %r2, 0(%r3)
66        %res = tail call i64 @llvm.bswap.i64(i64 %a)
67        store i64 %res, i64* %b
68        ret void
69}
70
71declare i16 @llvm.bswap.i16(i16) nounwind readnone
72declare i32 @llvm.bswap.i32(i32) nounwind readnone
73declare i64 @llvm.bswap.i64(i64) nounwind readnone
74
75