blob: 2fede53d4f48ade183eda3c85deac0103b1641ed [file] [log] [blame]
Reid Spencerd05b67d2006-12-02 20:38:10 +00001; RUN: llvm-upgrade %s | llvm-as | llc
Tanya Lattner2393a242004-11-06 23:08:26 +00002
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.
Vikram S. Advef2e343b2003-07-08 15:39:02 +000013
14%.str_1 = internal constant [30 x sbyte] c"d = %d, ct = %d, d ^ ct = %d\0A\00"
15
16
17implementation ; Functions:
18
19declare int %printf(sbyte*, ...)
20
21int %adj(uint %d.1, uint %ct.1) {
22entry:
23 %tmp.19 = seteq uint %ct.1, 2
24 %tmp.22.not = cast uint %ct.1 to bool
25 %tmp.221 = xor bool %tmp.22.not, true
26 %tmp.26 = or bool %tmp.19, %tmp.221
27 %tmp.27 = cast bool %tmp.26 to int
28 ret int %tmp.27
29}
30
31int %main() {
32entry:
33 %result = call int %adj(uint 3, uint 2)
34 %tmp.0 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([30 x sbyte]* %.str_1, long 0, long 0), uint 3, uint 2, int %result)
35 ret int 0
36}