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