~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to test/CodeGen/SystemZ/int-conv-06.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; Test zero extensions from a halfword to an i32.
 
2
;
 
3
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
 
4
 
 
5
; Test register extension, starting with an i32.
 
6
define i32 @f1(i32 %a) {
 
7
; CHECK: f1:
 
8
; CHECK: llhr %r2, %r2
 
9
; CHECk: br %r14
 
10
  %half = trunc i32 %a to i16
 
11
  %ext = zext i16 %half to i32
 
12
  ret i32 %ext
 
13
}
 
14
 
 
15
; ...and again with an i64.
 
16
define i32 @f2(i64 %a) {
 
17
; CHECK: f2:
 
18
; CHECK: llhr %r2, %r2
 
19
; CHECk: br %r14
 
20
  %half = trunc i64 %a to i16
 
21
  %ext = zext i16 %half to i32
 
22
  ret i32 %ext
 
23
}
 
24
 
 
25
; Check ANDs that are equivalent to zero extension.
 
26
define i32 @f3(i32 %a) {
 
27
; CHECK: f3:
 
28
; CHECK: llhr %r2, %r2
 
29
; CHECk: br %r14
 
30
  %ext = and i32 %a, 65535
 
31
  ret i32 %ext
 
32
}
 
33
 
 
34
; Check LLH with no displacement.
 
35
define i32 @f4(i16 *%src) {
 
36
; CHECK: f4:
 
37
; CHECK: llh %r2, 0(%r2)
 
38
; CHECK: br %r14
 
39
  %half = load i16 *%src
 
40
  %ext = zext i16 %half to i32
 
41
  ret i32 %ext
 
42
}
 
43
 
 
44
; Check the high end of the LLH range.
 
45
define i32 @f5(i16 *%src) {
 
46
; CHECK: f5:
 
47
; CHECK: llh %r2, 524286(%r2)
 
48
; CHECK: br %r14
 
49
  %ptr = getelementptr i16 *%src, i64 262143
 
50
  %half = load i16 *%ptr
 
51
  %ext = zext i16 %half to i32
 
52
  ret i32 %ext
 
53
}
 
54
 
 
55
; Check the next halfword up, which needs separate address logic.
 
56
; Other sequences besides this one would be OK.
 
57
define i32 @f6(i16 *%src) {
 
58
; CHECK: f6:
 
59
; CHECK: agfi %r2, 524288
 
60
; CHECK: llh %r2, 0(%r2)
 
61
; CHECK: br %r14
 
62
  %ptr = getelementptr i16 *%src, i64 262144
 
63
  %half = load i16 *%ptr
 
64
  %ext = zext i16 %half to i32
 
65
  ret i32 %ext
 
66
}
 
67
 
 
68
; Check the high end of the negative LLH range.
 
69
define i32 @f7(i16 *%src) {
 
70
; CHECK: f7:
 
71
; CHECK: llh %r2, -2(%r2)
 
72
; CHECK: br %r14
 
73
  %ptr = getelementptr i16 *%src, i64 -1
 
74
  %half = load i16 *%ptr
 
75
  %ext = zext i16 %half to i32
 
76
  ret i32 %ext
 
77
}
 
78
 
 
79
; Check the low end of the LLH range.
 
80
define i32 @f8(i16 *%src) {
 
81
; CHECK: f8:
 
82
; CHECK: llh %r2, -524288(%r2)
 
83
; CHECK: br %r14
 
84
  %ptr = getelementptr i16 *%src, i64 -262144
 
85
  %half = load i16 *%ptr
 
86
  %ext = zext i16 %half to i32
 
87
  ret i32 %ext
 
88
}
 
89
 
 
90
; Check the next halfword down, which needs separate address logic.
 
91
; Other sequences besides this one would be OK.
 
92
define i32 @f9(i16 *%src) {
 
93
; CHECK: f9:
 
94
; CHECK: agfi %r2, -524290
 
95
; CHECK: llh %r2, 0(%r2)
 
96
; CHECK: br %r14
 
97
  %ptr = getelementptr i16 *%src, i64 -262145
 
98
  %half = load i16 *%ptr
 
99
  %ext = zext i16 %half to i32
 
100
  ret i32 %ext
 
101
}
 
102
 
 
103
; Check that LLH allows an index
 
104
define i32 @f10(i64 %src, i64 %index) {
 
105
; CHECK: f10:
 
106
; CHECK: llh %r2, 524287(%r3,%r2)
 
107
; CHECK: br %r14
 
108
  %add1 = add i64 %src, %index
 
109
  %add2 = add i64 %add1, 524287
 
110
  %ptr = inttoptr i64 %add2 to i16 *
 
111
  %half = load i16 *%ptr
 
112
  %ext = zext i16 %half to i32
 
113
  ret i32 %ext
 
114
}