2009-07-17 22:38:58 +00:00
|
|
|
// RUN: llvm-mc -triple i386-unknown-unknown %s > %t
|
2009-06-30 02:10:03 +00:00
|
|
|
|
2010-10-25 20:18:41 +00:00
|
|
|
.macro check_expr
|
|
|
|
.if ($0) != ($1)
|
|
|
|
.abort Unexpected $0 != $1.
|
|
|
|
.endif
|
|
|
|
.endmacro
|
2011-08-20 16:10:09 +00:00
|
|
|
|
2009-06-30 02:10:03 +00:00
|
|
|
.text
|
|
|
|
g:
|
|
|
|
h:
|
|
|
|
j:
|
2011-08-20 16:10:09 +00:00
|
|
|
k:
|
2009-06-30 02:10:03 +00:00
|
|
|
.data
|
2010-10-25 20:18:41 +00:00
|
|
|
check_expr !1 + 2, 2
|
|
|
|
check_expr !0, 1
|
2010-10-25 20:18:49 +00:00
|
|
|
check_expr ~0, -1
|
|
|
|
check_expr -1, ~0
|
2010-10-25 20:18:41 +00:00
|
|
|
check_expr +1, 1
|
|
|
|
check_expr 1 + 2, 3
|
|
|
|
check_expr 1 & 3, 1
|
2010-10-25 20:18:53 +00:00
|
|
|
check_expr 4 / 2, 2
|
|
|
|
check_expr 4 / -2, -2
|
2010-10-25 20:18:41 +00:00
|
|
|
check_expr 1 == 1, 1
|
|
|
|
check_expr 1 == 0, 0
|
|
|
|
check_expr 1 > 0, 1
|
|
|
|
check_expr 1 >= 1, 1
|
|
|
|
check_expr 1 < 2, 1
|
|
|
|
check_expr 1 <= 1, 1
|
|
|
|
check_expr 4 % 3, 1
|
|
|
|
check_expr 2 * 2, 4
|
|
|
|
check_expr 2 != 2, 0
|
|
|
|
check_expr 2 <> 2, 0
|
|
|
|
check_expr 1 | 2, 3
|
|
|
|
check_expr 1 << 1, 2
|
|
|
|
check_expr 2 >> 1, 1
|
2010-10-25 20:18:49 +00:00
|
|
|
check_expr (~0 >> 1), -1
|
2010-10-25 20:18:41 +00:00
|
|
|
check_expr 3 - 2, 1
|
|
|
|
check_expr 1 ^ 3, 2
|
|
|
|
check_expr 1 && 2, 1
|
|
|
|
check_expr 3 && 0, 0
|
|
|
|
check_expr 0 && 1, 0
|
|
|
|
check_expr 1 || 2, 1
|
|
|
|
check_expr 0 || 1, 1
|
|
|
|
check_expr 0 || 0, 0
|
2010-10-25 20:18:56 +00:00
|
|
|
check_expr 1 + 2 < 3 + 4, 1
|
2011-08-20 16:24:13 +00:00
|
|
|
check_expr 1 << 8 - 1, 128
|
2011-08-20 16:10:09 +00:00
|
|
|
|
2009-06-29 20:37:27 +00:00
|
|
|
.set c, 10
|
2010-10-25 20:18:41 +00:00
|
|
|
check_expr c + 1, 11
|
2009-06-30 02:10:03 +00:00
|
|
|
|
|
|
|
d = e + 10
|
|
|
|
.long d
|
|
|
|
|
|
|
|
f = g - h + 5
|
|
|
|
.long f
|
|
|
|
|
|
|
|
i = (j + 10) - (k + 2)
|
|
|
|
.long i
|
2011-08-20 16:10:09 +00:00
|
|
|
|
2009-06-30 22:49:27 +00:00
|
|
|
l = m - n + 4
|
2011-08-20 16:10:09 +00:00
|
|
|
|
2009-06-30 22:49:27 +00:00
|
|
|
.text
|
|
|
|
m:
|
|
|
|
n:
|
|
|
|
nop
|
2011-08-20 16:10:09 +00:00
|
|
|
|
|
|
|
|
2010-01-24 01:07:33 +00:00
|
|
|
movw $8, (42)+66(%eax)
|
2010-04-14 04:40:28 +00:00
|
|
|
|
|
|
|
// "." support:
|
|
|
|
_f0:
|
|
|
|
L0:
|
|
|
|
jmp L1
|
|
|
|
.long . - L0
|
|
|
|
L1:
|
|
|
|
jmp A
|
|
|
|
.long . - L1
|