blob: b51105a0b192bfb7783791114bf39a3f5ee7d053 [file] [log] [blame]
Tanya Lattner2393a242004-11-06 23:08:26 +00001; RUN: llvm-as -f %s -o - | llc
2
Vikram S. Adve6781cd22003-07-10 19:31:26 +00003;; Date: Jul 8, 2003.
4;; From: test/Programs/MultiSource/Olden-perimeter
5;; Function: int %adj(uint %d.1, uint %ct.1)
6;;
7;; Errors: (1) cast-int-to-bool was being treated as a NOP (i.e., the int
8;; register was treated as effectively true if non-zero).
9;; This cannot be used for later boolean operations.
10;; (2) (A or NOT(B)) was being folded into A orn B, which is ok
11;; for bitwise operations but not booleans! For booleans,
12;; the result has to be compared with 0.
13;;
14;; LLC Output for the basic block (LLVM assembly is shown below):
15;;
16;; .L_adj_7_LL_4:
17;; sethi 0, %i0
18;; subcc %i1, 2, %g0
19;; move %icc, 1, %i0
20;; orn %i0, %i1, %i0
21;; ba .L_adj_7_LL_5
22;; nop
23;;
24
25
Vikram S. Advef2e343b2003-07-08 15:39:02 +000026target endian = big
27target pointersize = 64
28
29%.str_1 = internal constant [30 x sbyte] c"d = %d, ct = %d, d ^ ct = %d\0A\00"
30
31
32implementation ; Functions:
33
34declare int %printf(sbyte*, ...)
35
36int %adj(uint %d.1, uint %ct.1) {
37entry:
38 %tmp.19 = seteq uint %ct.1, 2
39 %tmp.22.not = cast uint %ct.1 to bool
40 %tmp.221 = xor bool %tmp.22.not, true
41 %tmp.26 = or bool %tmp.19, %tmp.221
42 %tmp.27 = cast bool %tmp.26 to int
43 ret int %tmp.27
44}
45
46int %main() {
47entry:
48 %result = call int %adj(uint 3, uint 2)
49 %tmp.0 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([30 x sbyte]* %.str_1, long 0, long 0), uint 3, uint 2, int %result)
50 ret int 0
51}