blob: 981a4e592cef02cf6c2a23f52676cce31c0fb863 [file] [log] [blame]
Dan Gohman1224c382009-07-20 21:19:07 +00001; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2
3@addr = external global i64
4
Dan Gohman1224c382009-07-20 21:19:07 +00005define i64 @add_unsigned(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +00006; CHECK: %z = add nuw i64 %x, %y
7 %z = add nuw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +00008 ret i64 %z
9}
10
11define i64 @sub_unsigned(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000012; CHECK: %z = sub nuw i64 %x, %y
13 %z = sub nuw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000014 ret i64 %z
15}
16
17define i64 @mul_unsigned(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000018; CHECK: %z = mul nuw i64 %x, %y
19 %z = mul nuw i64 %x, %y
Dan Gohman08d012e2009-07-22 22:44:56 +000020 ret i64 %z
21}
22
23define i64 @add_signed(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000024; CHECK: %z = add nsw i64 %x, %y
25 %z = add nsw i64 %x, %y
Dan Gohman08d012e2009-07-22 22:44:56 +000026 ret i64 %z
27}
28
29define i64 @sub_signed(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000030; CHECK: %z = sub nsw i64 %x, %y
31 %z = sub nsw i64 %x, %y
Dan Gohman08d012e2009-07-22 22:44:56 +000032 ret i64 %z
33}
34
35define i64 @mul_signed(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000036; CHECK: %z = mul nsw i64 %x, %y
37 %z = mul nsw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000038 ret i64 %z
39}
40
41define i64 @add_plain(i64 %x, i64 %y) {
42; CHECK: %z = add i64 %x, %y
43 %z = add i64 %x, %y
44 ret i64 %z
45}
46
47define i64 @sub_plain(i64 %x, i64 %y) {
48; CHECK: %z = sub i64 %x, %y
49 %z = sub i64 %x, %y
50 ret i64 %z
51}
52
53define i64 @mul_plain(i64 %x, i64 %y) {
54; CHECK: %z = mul i64 %x, %y
55 %z = mul i64 %x, %y
56 ret i64 %z
57}
58
59define i64 @add_both(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000060; CHECK: %z = add nuw nsw i64 %x, %y
61 %z = add nuw nsw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000062 ret i64 %z
63}
64
65define i64 @sub_both(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000066; CHECK: %z = sub nuw nsw i64 %x, %y
67 %z = sub nuw nsw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000068 ret i64 %z
69}
70
71define i64 @mul_both(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000072; CHECK: %z = mul nuw nsw i64 %x, %y
73 %z = mul nuw nsw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000074 ret i64 %z
75}
76
77define i64 @add_both_reversed(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000078; CHECK: %z = add nuw nsw i64 %x, %y
79 %z = add nsw nuw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000080 ret i64 %z
81}
82
83define i64 @sub_both_reversed(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000084; CHECK: %z = sub nuw nsw i64 %x, %y
85 %z = sub nsw nuw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000086 ret i64 %z
87}
88
89define i64 @mul_both_reversed(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000090; CHECK: %z = mul nuw nsw i64 %x, %y
91 %z = mul nsw nuw i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000092 ret i64 %z
93}
94
95define i64 @sdiv_exact(i64 %x, i64 %y) {
Dan Gohman59858cf2009-07-27 16:11:46 +000096; CHECK: %z = sdiv exact i64 %x, %y
97 %z = sdiv exact i64 %x, %y
Dan Gohman1224c382009-07-20 21:19:07 +000098 ret i64 %z
99}
100
101define i64 @sdiv_plain(i64 %x, i64 %y) {
102; CHECK: %z = sdiv i64 %x, %y
103 %z = sdiv i64 %x, %y
104 ret i64 %z
105}
106
Dan Gohmandd8004d2009-07-27 21:53:46 +0000107define i64* @gep_nw(i64* %p, i64 %x) {
108; CHECK: %z = getelementptr inbounds i64* %p, i64 %x
109 %z = getelementptr inbounds i64* %p, i64 %x
110 ret i64* %z
111}
112
113define i64* @gep_plain(i64* %p, i64 %x) {
114; CHECK: %z = getelementptr i64* %p, i64 %x
115 %z = getelementptr i64* %p, i64 %x
116 ret i64* %z
117}
118
Dan Gohman1224c382009-07-20 21:19:07 +0000119define i64 @add_both_ce() {
Dan Gohman59858cf2009-07-27 16:11:46 +0000120; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
121 ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
Dan Gohman1224c382009-07-20 21:19:07 +0000122}
123
124define i64 @sub_both_ce() {
Dan Gohman59858cf2009-07-27 16:11:46 +0000125; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
126 ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
Dan Gohman1224c382009-07-20 21:19:07 +0000127}
128
129define i64 @mul_both_ce() {
Dan Gohman59858cf2009-07-27 16:11:46 +0000130; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
131 ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
Dan Gohman1224c382009-07-20 21:19:07 +0000132}
133
134define i64 @sdiv_exact_ce() {
Dan Gohman59858cf2009-07-27 16:11:46 +0000135; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
136 ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
Dan Gohman1224c382009-07-20 21:19:07 +0000137}
Dan Gohmandd8004d2009-07-27 21:53:46 +0000138
139define i64* @gep_nw_ce() {
140; CHECK: ret i64* getelementptr inbounds (i64* @addr, i64 171)
141 ret i64* getelementptr inbounds (i64* @addr, i64 171)
142}
143
144