• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=0 | \
2; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s
3; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \
4; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWON %s
5; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -fixup-byte-word-insts=0 | \
6; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s
7; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \
8; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWON %s
9; RUN: llc < %s -mtriple=x86_64-apple-darwin -fixup-byte-word-insts=0 | \
10; RUN:   FileCheck -check-prefix=DARWIN -check-prefix=DARWIN-BWOFF %s
11; RUN: llc < %s -mtriple=x86_64-apple-darwin -fixup-byte-word-insts=1 | \
12; RUN:   FileCheck -check-prefix=DARWIN -check-prefix=DARWIN-BWON %s
13
14
15@x = common global i32 0, align 4
16
17define zeroext i1 @unsigned_i1() {
18entry:
19  %0 = load i32, i32* @x
20  %cmp = icmp eq i32 %0, 42
21  ret i1 %cmp
22
23; Unsigned i1 return values are not extended.
24; CHECK-LABEL: unsigned_i1:
25; CHECK:			 cmp
26; CHECK-NEXT:  sete
27; CHECK-NEXT:  ret
28}
29
30define zeroext i8 @unsigned_i8() {
31entry:
32  %0 = load i32, i32* @x
33  %cmp = icmp eq i32 %0, 42
34  %retval = zext i1 %cmp to i8
35  ret i8 %retval
36
37; Unsigned i8 return values are not extended.
38; CHECK-LABEL: unsigned_i8:
39; CHECK:			 cmp
40; CHECK-NEXT:  sete
41; CHECK-NEXT:  ret
42
43; Except on Darwin, for legacy reasons.
44; DARWIN-LABEL: unsigned_i8:
45; DARWIN:       xorl
46; DARWIN-NEXT:  cmp
47; DARWIN-NEXT:  sete
48; DARWIN-NEXT:  ret
49}
50
51define signext i8 @signed_i8() {
52entry:
53  %0 = load i32, i32* @x
54  %cmp = icmp eq i32 %0, 42
55  %retval = zext i1 %cmp to i8
56  ret i8 %retval
57
58; Signed i8 return values are not extended.
59; CHECK-LABEL: signed_i8:
60; CHECK:			 cmp
61; CHECK-NEXT:  sete
62; CHECK-NEXT:  ret
63
64; Except on Darwin, for legacy reasons.
65; DARWIN-LABEL: signed_i8:
66; DARWIN:       xorl
67; DARWIN-NEXT:  cmp
68; DARWIN-NEXT:  sete
69; DARWIN-NEXT:  ret
70}
71
72@a = common global i16 0
73@b = common global i16 0
74define zeroext i16 @unsigned_i16() {
75entry:
76  %0 = load i16, i16* @a
77  %1 = load i16, i16* @b
78  %add = add i16 %1, %0
79  ret i16 %add
80
81; i16 return values are not extended.
82; CHECK-LABEL: unsigned_i16:
83; BWOFF:       movw
84; BWON:        movzwl
85; CHECK-NEXT:  addw
86; CHECK-NEXT:  ret
87
88; Except on Darwin, for legacy reasons.
89; DARWIN-LABEL: unsigned_i16:
90; DARWIN-BWOFF: movw
91; DARWIN-BWON:  movzwl
92; DARWIN-NEXT:  addw
93; DARWIN-NEXT:  movzwl
94; DARWIN-NEXT:  ret
95}
96
97
98define i32 @use_i1() {
99entry:
100  %0 = call i1 @unsigned_i1();
101  %1 = zext i1 %0 to i32
102  ret i32 %1
103
104; The high 24 bits of %eax from a function returning i1 are undefined.
105; CHECK-LABEL: use_i1:
106; CHECK: call
107; CHECK-NEXT: movzbl
108; CHECK-NEXT: {{pop|add}}
109; CHECK-NEXT: ret
110}
111
112define i32 @use_i8() {
113entry:
114  %0 = call i8 @unsigned_i8();
115  %1 = zext i8 %0 to i32
116  ret i32 %1
117
118; The high 24 bits of %eax from a function returning i8 are undefined.
119; CHECK-LABEL: use_i8:
120; CHECK: call
121; CHECK-NEXT: movzbl
122; CHECK-NEXT: {{pop|add}}
123; CHECK-NEXT: ret
124}
125
126define i32 @use_i16() {
127entry:
128  %0 = call i16 @unsigned_i16();
129  %1 = zext i16 %0 to i32
130  ret i32 %1
131
132; The high 16 bits of %eax from a function returning i16 are undefined.
133; CHECK-LABEL: use_i16:
134; CHECK: call
135; CHECK-NEXT: movzwl
136; CHECK-NEXT: {{pop|add}}
137; CHECK-NEXT: ret
138}
139