llvm.org GIT mirror llvm / bd6161d
Three kinds of boolean values handled incorrectly: -- setCC of FP type used by a Phi: have to save in reg. -- setNE of FP type used by a branch: cannot use result directly in branch! -- setCC used outside the same basic block: have to save in reg. for now git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6382 91177308-0d34-0410-b5e6-96231b3b80d8 Vikram S. Adve 17 years ago
6 changed file(s) with 394 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c
2 ;; Function: Matrix QRiterate(Matrix A, Matrix U)
3 ;;
4 ;; Error: llc produces an invalid register for the
5 ;; phi argument %tmp.213 produced by fcmpd:
6 ;;
7 ;; LLC Output:
8 ;;
9 ;; !****** Outputing Function: QRiterate_1 ******
10 ;;
11 ;; .section ".text"
12 ;; .align 4
13 ;; .global QRiterate_1
14 ;; .type QRiterate_1, 2
15 ;; QRiterate_1:
16 ;; .L_QRiterate_1_LL_0:
17 ;; save %o6, -192, %o6
18 ;; brgz %i0, .L_QRiterate_1_LL_1
19 ;; add %g0, %g0, %o0
20 ;; ba .L_QRiterate_1_LL_2
21 ;; nop
22 ;;
23 ;; .L_QRiterate_1_LL_1:
24 ;; sethi %lm(LLVMGlobal__2), %o1
25 ;; sethi %hh(LLVMGlobal__2), %o0
26 ;; or %o0, %hm(LLVMGlobal__2), %o0
27 ;; sllx %o0, 32, %o0
28 ;; or %o1, %o0, %o1
29 ;; or %o1, %lo(LLVMGlobal__2), %o1
30 ;; ldd [%o1+0], %f32
31 ;; fcmpd %fcc0, %f2, %f32
32 ;; ba .L_QRiterate_1_LL_2
33 ;; add , %g0, %o0
34 ;;
35 ;; .L_QRiterate_1_LL_2:
36 ;; brnz %o0, .L_QRiterate_1_LL_1
37 ;; nop
38 ;; ba .L_QRiterate_1_LL_3
39 ;; nop
40 ;;
41 ;; .L_QRiterate_1_LL_3:
42 ;; jmpl %i7+8, %g0
43 ;; restore %g0, 0, %g0
44 ;;
45 ;; .EndOf_QRiterate_1:
46 ;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1
47 ;;
48
49
50 target endian = big
51 target pointersize = 64
52
53 implementation ; Functions:
54
55 internal void %QRiterate(int %p.1, double %tmp.212) {
56 entry: ; No predecessors!
57 %tmp.184 = setgt int %p.1, 0 ; [#uses=1]
58 br bool %tmp.184, label %shortcirc_next.1, label %shortcirc_done.1
59
60 shortcirc_next.1: ; preds = %entry
61 %tmp.213 = setne double %tmp.212, 0.000000e+00
62 br label %shortcirc_done.1
63
64 shortcirc_done.1: ; preds = %entry, %shortcirc_next.1
65 %val.1 = phi bool [ false, %entry ], [ %tmp.213, %shortcirc_next.1 ]
66 br bool %val.1, label %shortcirc_next.1, label %exit.1
67
68 exit.1:
69 ret void
70 }
0 ;; Date: May 27, 2003.
1 ;; From: Variant of 2003-05-27-usefsubasbool.ll
2 ;;
3 ;; Error: llc fails to save a boolean value in a register (and later uses an
4 ;; invalid register in a BRNZ) for a boolean value
5 ;; used only by branches but in a different basic block.
6 ;;
7 ;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setCC
8 ;; is used only for branches, it is not saved into an int. register.
9 ;; But if the boolean is used in a branch in a different basic block,
10 ;; that branch uses a BRNZ inst. instead of a branch-on-CC.
11 ;;
12 ;; LLC Output before fix:
13 ;; !****** Outputing Function: QRiterate_1 ******
14 ;;
15 ;; .section ".text"
16 ;; .align 4
17 ;; .global QRiterate_1
18 ;; .type QRiterate_1, 2
19 ;; QRiterate_1:
20 ;; .L_QRiterate_1_LL_0:
21 ;; save %o6, -192, %o6
22 ;; sethi %lm(LLVMGlobal__2), %o2
23 ;; sethi %hh(LLVMGlobal__2), %o1
24 ;; or %o1, %hm(LLVMGlobal__2), %o1
25 ;; sllx %o1, 32, %o1
26 ;; or %o2, %o1, %o2
27 ;; or %o2, %lo(LLVMGlobal__2), %o2
28 ;; ldd [%o2+0], %f32
29 ;; fcmpd %fcc0, %f0, %f32
30 ;; ba .L_QRiterate_1_LL_1
31 ;; nop
32 ;;
33 ;; .L_QRiterate_1_LL_1:
34 ;; brnz , .L_QRiterate_1_LL_1
35 ;; nop
36 ;; ba .L_QRiterate_1_LL_2
37 ;; nop
38 ;;
39 ;; .L_QRiterate_1_LL_2:
40 ;; jmpl %i7+8, %g0
41 ;; restore %g0, 0, %g0
42 ;;
43 ;; .EndOf_QRiterate_1:
44 ;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1
45 ;;
46
47 target endian = big
48 target pointersize = 64
49
50 implementation ; Functions:
51
52 internal void %QRiterate(double %tmp.212) {
53 entry: ; No predecessors!
54 %tmp.213 = setne double %tmp.212, 0.000000e+00
55 br label %shortcirc_next.1
56
57 shortcirc_next.1: ; preds = %entry
58 br bool %tmp.213, label %shortcirc_next.1, label %exit.1
59
60 exit.1:
61 ret void
62 }
0 ;; Date: May 27, 2003.
1 ;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c
2 ;; Function: Matrix QRiterate(Matrix A, Matrix U)
3 ;;
4 ;; Error: llc produces an invalid register for the
5 ;; a boolean value computed using setne with a double.
6 ;;
7 ;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setne
8 ;; is used for a branch, it can generate a "branch-on-integer-register"
9 ;; for integer registers. In that case, it never saves the value of
10 ;; the boolean result. It was attempting to do the same thing for an
11 ;; FP compare!
12 ;;
13 ;; LLC Output:
14 ;; !****** Outputing Function: QRiterate_1 ******
15 ;;
16 ;; .section ".text"
17 ;; .align 4
18 ;; .global QRiterate_1
19 ;; .type QRiterate_1, 2
20 ;; QRiterate_1:
21 ;; .L_QRiterate_1_LL_0:
22 ;; save %o6, -192, %o6
23 ;; sethi %hh(LLVMGlobal__2), %o1
24 ;; sethi %lm(LLVMGlobal__2), %o0
25 ;; or %o1, %hm(LLVMGlobal__2), %o1
26 ;; sllx %o1, 32, %o1
27 ;; or %o0, %o1, %o0
28 ;; or %o0, %lo(LLVMGlobal__2), %o0
29 ;; ldd [%o0+0], %f32
30 ;; ba .L_QRiterate_1_LL_1
31 ;; fcmpd %fcc0, %f0, %f32
32 ;;
33 ;; .L_QRiterate_1_LL_1:
34 ;; brnz , .L_QRiterate_1_LL_1
35 ;; nop
36 ;; ba .L_QRiterate_1_LL_2
37 ;; nop
38 ;;
39 ;; .L_QRiterate_1_LL_2:
40 ;; jmpl %i7+8, %g0
41 ;; restore %g0, 0, %g0
42 ;;
43 ;; .EndOf_QRiterate_1:
44 ;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1
45 ;;
46
47 target endian = big
48 target pointersize = 64
49
50 implementation ; Functions:
51
52 internal void %QRiterate(double %tmp.212) {
53 entry: ; No predecessors!
54 br label %shortcirc_next.1
55
56 shortcirc_next.1: ; preds = %entry
57 %tmp.213 = setne double %tmp.212, 0.000000e+00
58 br bool %tmp.213, label %shortcirc_next.1, label %exit.1
59
60 exit.1:
61 ret void
62 }
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c
2 ;; Function: Matrix QRiterate(Matrix A, Matrix U)
3 ;;
4 ;; Error: llc produces an invalid register for the
5 ;; phi argument %tmp.213 produced by fcmpd:
6 ;;
7 ;; LLC Output:
8 ;;
9 ;; !****** Outputing Function: QRiterate_1 ******
10 ;;
11 ;; .section ".text"
12 ;; .align 4
13 ;; .global QRiterate_1
14 ;; .type QRiterate_1, 2
15 ;; QRiterate_1:
16 ;; .L_QRiterate_1_LL_0:
17 ;; save %o6, -192, %o6
18 ;; brgz %i0, .L_QRiterate_1_LL_1
19 ;; add %g0, %g0, %o0
20 ;; ba .L_QRiterate_1_LL_2
21 ;; nop
22 ;;
23 ;; .L_QRiterate_1_LL_1:
24 ;; sethi %lm(LLVMGlobal__2), %o1
25 ;; sethi %hh(LLVMGlobal__2), %o0
26 ;; or %o0, %hm(LLVMGlobal__2), %o0
27 ;; sllx %o0, 32, %o0
28 ;; or %o1, %o0, %o1
29 ;; or %o1, %lo(LLVMGlobal__2), %o1
30 ;; ldd [%o1+0], %f32
31 ;; fcmpd %fcc0, %f2, %f32
32 ;; ba .L_QRiterate_1_LL_2
33 ;; add , %g0, %o0
34 ;;
35 ;; .L_QRiterate_1_LL_2:
36 ;; brnz %o0, .L_QRiterate_1_LL_1
37 ;; nop
38 ;; ba .L_QRiterate_1_LL_3
39 ;; nop
40 ;;
41 ;; .L_QRiterate_1_LL_3:
42 ;; jmpl %i7+8, %g0
43 ;; restore %g0, 0, %g0
44 ;;
45 ;; .EndOf_QRiterate_1:
46 ;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1
47 ;;
48
49
50 target endian = big
51 target pointersize = 64
52
53 implementation ; Functions:
54
55 internal void %QRiterate(int %p.1, double %tmp.212) {
56 entry: ; No predecessors!
57 %tmp.184 = setgt int %p.1, 0 ; [#uses=1]
58 br bool %tmp.184, label %shortcirc_next.1, label %shortcirc_done.1
59
60 shortcirc_next.1: ; preds = %entry
61 %tmp.213 = setne double %tmp.212, 0.000000e+00
62 br label %shortcirc_done.1
63
64 shortcirc_done.1: ; preds = %entry, %shortcirc_next.1
65 %val.1 = phi bool [ false, %entry ], [ %tmp.213, %shortcirc_next.1 ]
66 br bool %val.1, label %shortcirc_next.1, label %exit.1
67
68 exit.1:
69 ret void
70 }
0 ;; Date: May 27, 2003.
1 ;; From: Variant of 2003-05-27-usefsubasbool.ll
2 ;;
3 ;; Error: llc fails to save a boolean value in a register (and later uses an
4 ;; invalid register in a BRNZ) for a boolean value
5 ;; used only by branches but in a different basic block.
6 ;;
7 ;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setCC
8 ;; is used only for branches, it is not saved into an int. register.
9 ;; But if the boolean is used in a branch in a different basic block,
10 ;; that branch uses a BRNZ inst. instead of a branch-on-CC.
11 ;;
12 ;; LLC Output before fix:
13 ;; !****** Outputing Function: QRiterate_1 ******
14 ;;
15 ;; .section ".text"
16 ;; .align 4
17 ;; .global QRiterate_1
18 ;; .type QRiterate_1, 2
19 ;; QRiterate_1:
20 ;; .L_QRiterate_1_LL_0:
21 ;; save %o6, -192, %o6
22 ;; sethi %lm(LLVMGlobal__2), %o2
23 ;; sethi %hh(LLVMGlobal__2), %o1
24 ;; or %o1, %hm(LLVMGlobal__2), %o1
25 ;; sllx %o1, 32, %o1
26 ;; or %o2, %o1, %o2
27 ;; or %o2, %lo(LLVMGlobal__2), %o2
28 ;; ldd [%o2+0], %f32
29 ;; fcmpd %fcc0, %f0, %f32
30 ;; ba .L_QRiterate_1_LL_1
31 ;; nop
32 ;;
33 ;; .L_QRiterate_1_LL_1:
34 ;; brnz , .L_QRiterate_1_LL_1
35 ;; nop
36 ;; ba .L_QRiterate_1_LL_2
37 ;; nop
38 ;;
39 ;; .L_QRiterate_1_LL_2:
40 ;; jmpl %i7+8, %g0
41 ;; restore %g0, 0, %g0
42 ;;
43 ;; .EndOf_QRiterate_1:
44 ;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1
45 ;;
46
47 target endian = big
48 target pointersize = 64
49
50 implementation ; Functions:
51
52 internal void %QRiterate(double %tmp.212) {
53 entry: ; No predecessors!
54 %tmp.213 = setne double %tmp.212, 0.000000e+00
55 br label %shortcirc_next.1
56
57 shortcirc_next.1: ; preds = %entry
58 br bool %tmp.213, label %shortcirc_next.1, label %exit.1
59
60 exit.1:
61 ret void
62 }
0 ;; Date: May 27, 2003.
1 ;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c
2 ;; Function: Matrix QRiterate(Matrix A, Matrix U)
3 ;;
4 ;; Error: llc produces an invalid register for the
5 ;; a boolean value computed using setne with a double.
6 ;;
7 ;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setne
8 ;; is used for a branch, it can generate a "branch-on-integer-register"
9 ;; for integer registers. In that case, it never saves the value of
10 ;; the boolean result. It was attempting to do the same thing for an
11 ;; FP compare!
12 ;;
13 ;; LLC Output:
14 ;; !****** Outputing Function: QRiterate_1 ******
15 ;;
16 ;; .section ".text"
17 ;; .align 4
18 ;; .global QRiterate_1
19 ;; .type QRiterate_1, 2
20 ;; QRiterate_1:
21 ;; .L_QRiterate_1_LL_0:
22 ;; save %o6, -192, %o6
23 ;; sethi %hh(LLVMGlobal__2), %o1
24 ;; sethi %lm(LLVMGlobal__2), %o0
25 ;; or %o1, %hm(LLVMGlobal__2), %o1
26 ;; sllx %o1, 32, %o1
27 ;; or %o0, %o1, %o0
28 ;; or %o0, %lo(LLVMGlobal__2), %o0
29 ;; ldd [%o0+0], %f32
30 ;; ba .L_QRiterate_1_LL_1
31 ;; fcmpd %fcc0, %f0, %f32
32 ;;
33 ;; .L_QRiterate_1_LL_1:
34 ;; brnz , .L_QRiterate_1_LL_1
35 ;; nop
36 ;; ba .L_QRiterate_1_LL_2
37 ;; nop
38 ;;
39 ;; .L_QRiterate_1_LL_2:
40 ;; jmpl %i7+8, %g0
41 ;; restore %g0, 0, %g0
42 ;;
43 ;; .EndOf_QRiterate_1:
44 ;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1
45 ;;
46
47 target endian = big
48 target pointersize = 64
49
50 implementation ; Functions:
51
52 internal void %QRiterate(double %tmp.212) {
53 entry: ; No predecessors!
54 br label %shortcirc_next.1
55
56 shortcirc_next.1: ; preds = %entry
57 %tmp.213 = setne double %tmp.212, 0.000000e+00
58 br bool %tmp.213, label %shortcirc_next.1, label %exit.1
59
60 exit.1:
61 ret void
62 }