Cleanup a bunch of tests. In particular do not allow target directives in
[oota-llvm.git] / test / CodeGen / Generic / 2003-07-08-BadCastToBool.ll
1 ; RUN: llvm-as -f %s -o - | llc
2
3 ;; 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 %.str_1 = internal constant [30 x sbyte] c"d = %d, ct = %d, d ^ ct = %d\0A\00"
15
16
17 implementation   ; Functions:
18
19 declare int %printf(sbyte*, ...)
20
21 int %adj(uint %d.1, uint %ct.1) {
22 entry:
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
31 int %main() {
32 entry:
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 }