diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2003-05-28 13:54:41 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2003-05-28 13:54:41 +0000 |
commit | bd6161d401d16167be100b8d05ea3cc324711fb0 (patch) | |
tree | 25bc1f2e704879844769ad6393402197f66308a9 | |
parent | f2ef76782d0a2b10fdadc54e33da8e3f086fe8d6 (diff) |
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
-rw-r--r-- | test/CodeGen/Generic/2003-05-27-phifcmpd.ll | 71 | ||||
-rw-r--r-- | test/CodeGen/Generic/2003-05-27-useboolinotherbb.ll | 63 | ||||
-rw-r--r-- | test/CodeGen/Generic/2003-05-27-usefsubasbool.ll | 63 | ||||
-rw-r--r-- | test/LLC/2003-05-27-phifcmpd.ll | 71 | ||||
-rw-r--r-- | test/LLC/2003-05-27-useboolinotherbb.ll | 63 | ||||
-rw-r--r-- | test/LLC/2003-05-27-usefsubasbool.ll | 63 |
6 files changed, 394 insertions, 0 deletions
diff --git a/test/CodeGen/Generic/2003-05-27-phifcmpd.ll b/test/CodeGen/Generic/2003-05-27-phifcmpd.ll new file mode 100644 index 0000000000..1561bebaad --- /dev/null +++ b/test/CodeGen/Generic/2003-05-27-phifcmpd.ll @@ -0,0 +1,71 @@ +;; Date: May 28, 2003. +;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c +;; Function: Matrix QRiterate(Matrix A, Matrix U) +;; +;; Error: llc produces an invalid register <NULL VALUE> for the +;; phi argument %tmp.213 produced by fcmpd: +;; +;; LLC Output: +;; +;; !****** Outputing Function: QRiterate_1 ****** +;; +;; .section ".text" +;; .align 4 +;; .global QRiterate_1 +;; .type QRiterate_1, 2 +;; QRiterate_1: +;; .L_QRiterate_1_LL_0: +;; save %o6, -192, %o6 +;; brgz %i0, .L_QRiterate_1_LL_1 +;; add %g0, %g0, %o0 +;; ba .L_QRiterate_1_LL_2 +;; nop +;; +;; .L_QRiterate_1_LL_1: +;; sethi %lm(LLVMGlobal__2), %o1 +;; sethi %hh(LLVMGlobal__2), %o0 +;; or %o0, %hm(LLVMGlobal__2), %o0 +;; sllx %o0, 32, %o0 +;; or %o1, %o0, %o1 +;; or %o1, %lo(LLVMGlobal__2), %o1 +;; ldd [%o1+0], %f32 +;; fcmpd %fcc0, %f2, %f32 +;; ba .L_QRiterate_1_LL_2 +;; add <NULL VALUE>, %g0, %o0 +;; +;; .L_QRiterate_1_LL_2: +;; brnz %o0, .L_QRiterate_1_LL_1 +;; nop +;; ba .L_QRiterate_1_LL_3 +;; nop +;; +;; .L_QRiterate_1_LL_3: +;; jmpl %i7+8, %g0 +;; restore %g0, 0, %g0 +;; +;; .EndOf_QRiterate_1: +;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 +;; + + +target endian = big +target pointersize = 64 + +implementation ; Functions: + +internal void %QRiterate(int %p.1, double %tmp.212) { +entry: ; No predecessors! + %tmp.184 = setgt int %p.1, 0 ; <bool> [#uses=1] + br bool %tmp.184, label %shortcirc_next.1, label %shortcirc_done.1 + +shortcirc_next.1: ; preds = %entry + %tmp.213 = setne double %tmp.212, 0.000000e+00 + br label %shortcirc_done.1 + +shortcirc_done.1: ; preds = %entry, %shortcirc_next.1 + %val.1 = phi bool [ false, %entry ], [ %tmp.213, %shortcirc_next.1 ] + br bool %val.1, label %shortcirc_next.1, label %exit.1 + +exit.1: + ret void +} diff --git a/test/CodeGen/Generic/2003-05-27-useboolinotherbb.ll b/test/CodeGen/Generic/2003-05-27-useboolinotherbb.ll new file mode 100644 index 0000000000..ef8b8cc7e9 --- /dev/null +++ b/test/CodeGen/Generic/2003-05-27-useboolinotherbb.ll @@ -0,0 +1,63 @@ +;; Date: May 27, 2003. +;; From: Variant of 2003-05-27-usefsubasbool.ll +;; +;; Error: llc fails to save a boolean value in a register (and later uses an +;; invalid register <NULL VALUE> in a BRNZ) for a boolean value +;; used only by branches but in a different basic block. +;; +;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setCC +;; is used only for branches, it is not saved into an int. register. +;; But if the boolean is used in a branch in a different basic block, +;; that branch uses a BRNZ inst. instead of a branch-on-CC. +;; +;; LLC Output before fix: +;; !****** Outputing Function: QRiterate_1 ****** +;; +;; .section ".text" +;; .align 4 +;; .global QRiterate_1 +;; .type QRiterate_1, 2 +;; QRiterate_1: +;; .L_QRiterate_1_LL_0: +;; save %o6, -192, %o6 +;; sethi %lm(LLVMGlobal__2), %o2 +;; sethi %hh(LLVMGlobal__2), %o1 +;; or %o1, %hm(LLVMGlobal__2), %o1 +;; sllx %o1, 32, %o1 +;; or %o2, %o1, %o2 +;; or %o2, %lo(LLVMGlobal__2), %o2 +;; ldd [%o2+0], %f32 +;; fcmpd %fcc0, %f0, %f32 +;; ba .L_QRiterate_1_LL_1 +;; nop +;; +;; .L_QRiterate_1_LL_1: +;; brnz <NULL_VALUE>, .L_QRiterate_1_LL_1 +;; nop +;; ba .L_QRiterate_1_LL_2 +;; nop +;; +;; .L_QRiterate_1_LL_2: +;; jmpl %i7+8, %g0 +;; restore %g0, 0, %g0 +;; +;; .EndOf_QRiterate_1: +;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 +;; + +target endian = big +target pointersize = 64 + +implementation ; Functions: + +internal void %QRiterate(double %tmp.212) { +entry: ; No predecessors! + %tmp.213 = setne double %tmp.212, 0.000000e+00 + br label %shortcirc_next.1 + +shortcirc_next.1: ; preds = %entry + br bool %tmp.213, label %shortcirc_next.1, label %exit.1 + +exit.1: + ret void +} diff --git a/test/CodeGen/Generic/2003-05-27-usefsubasbool.ll b/test/CodeGen/Generic/2003-05-27-usefsubasbool.ll new file mode 100644 index 0000000000..124b267ca2 --- /dev/null +++ b/test/CodeGen/Generic/2003-05-27-usefsubasbool.ll @@ -0,0 +1,63 @@ +;; Date: May 27, 2003. +;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c +;; Function: Matrix QRiterate(Matrix A, Matrix U) +;; +;; Error: llc produces an invalid register <NULL VALUE> for the +;; a boolean value computed using setne with a double. +;; +;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setne +;; is used for a branch, it can generate a "branch-on-integer-register" +;; for integer registers. In that case, it never saves the value of +;; the boolean result. It was attempting to do the same thing for an +;; FP compare! +;; +;; LLC Output: +;; !****** Outputing Function: QRiterate_1 ****** +;; +;; .section ".text" +;; .align 4 +;; .global QRiterate_1 +;; .type QRiterate_1, 2 +;; QRiterate_1: +;; .L_QRiterate_1_LL_0: +;; save %o6, -192, %o6 +;; sethi %hh(LLVMGlobal__2), %o1 +;; sethi %lm(LLVMGlobal__2), %o0 +;; or %o1, %hm(LLVMGlobal__2), %o1 +;; sllx %o1, 32, %o1 +;; or %o0, %o1, %o0 +;; or %o0, %lo(LLVMGlobal__2), %o0 +;; ldd [%o0+0], %f32 +;; ba .L_QRiterate_1_LL_1 +;; fcmpd %fcc0, %f0, %f32 +;; +;; .L_QRiterate_1_LL_1: +;; brnz <NULL VALUE>, .L_QRiterate_1_LL_1 +;; nop +;; ba .L_QRiterate_1_LL_2 +;; nop +;; +;; .L_QRiterate_1_LL_2: +;; jmpl %i7+8, %g0 +;; restore %g0, 0, %g0 +;; +;; .EndOf_QRiterate_1: +;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 +;; + +target endian = big +target pointersize = 64 + +implementation ; Functions: + +internal void %QRiterate(double %tmp.212) { +entry: ; No predecessors! + br label %shortcirc_next.1 + +shortcirc_next.1: ; preds = %entry + %tmp.213 = setne double %tmp.212, 0.000000e+00 + br bool %tmp.213, label %shortcirc_next.1, label %exit.1 + +exit.1: + ret void +} diff --git a/test/LLC/2003-05-27-phifcmpd.ll b/test/LLC/2003-05-27-phifcmpd.ll new file mode 100644 index 0000000000..1561bebaad --- /dev/null +++ b/test/LLC/2003-05-27-phifcmpd.ll @@ -0,0 +1,71 @@ +;; Date: May 28, 2003. +;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c +;; Function: Matrix QRiterate(Matrix A, Matrix U) +;; +;; Error: llc produces an invalid register <NULL VALUE> for the +;; phi argument %tmp.213 produced by fcmpd: +;; +;; LLC Output: +;; +;; !****** Outputing Function: QRiterate_1 ****** +;; +;; .section ".text" +;; .align 4 +;; .global QRiterate_1 +;; .type QRiterate_1, 2 +;; QRiterate_1: +;; .L_QRiterate_1_LL_0: +;; save %o6, -192, %o6 +;; brgz %i0, .L_QRiterate_1_LL_1 +;; add %g0, %g0, %o0 +;; ba .L_QRiterate_1_LL_2 +;; nop +;; +;; .L_QRiterate_1_LL_1: +;; sethi %lm(LLVMGlobal__2), %o1 +;; sethi %hh(LLVMGlobal__2), %o0 +;; or %o0, %hm(LLVMGlobal__2), %o0 +;; sllx %o0, 32, %o0 +;; or %o1, %o0, %o1 +;; or %o1, %lo(LLVMGlobal__2), %o1 +;; ldd [%o1+0], %f32 +;; fcmpd %fcc0, %f2, %f32 +;; ba .L_QRiterate_1_LL_2 +;; add <NULL VALUE>, %g0, %o0 +;; +;; .L_QRiterate_1_LL_2: +;; brnz %o0, .L_QRiterate_1_LL_1 +;; nop +;; ba .L_QRiterate_1_LL_3 +;; nop +;; +;; .L_QRiterate_1_LL_3: +;; jmpl %i7+8, %g0 +;; restore %g0, 0, %g0 +;; +;; .EndOf_QRiterate_1: +;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 +;; + + +target endian = big +target pointersize = 64 + +implementation ; Functions: + +internal void %QRiterate(int %p.1, double %tmp.212) { +entry: ; No predecessors! + %tmp.184 = setgt int %p.1, 0 ; <bool> [#uses=1] + br bool %tmp.184, label %shortcirc_next.1, label %shortcirc_done.1 + +shortcirc_next.1: ; preds = %entry + %tmp.213 = setne double %tmp.212, 0.000000e+00 + br label %shortcirc_done.1 + +shortcirc_done.1: ; preds = %entry, %shortcirc_next.1 + %val.1 = phi bool [ false, %entry ], [ %tmp.213, %shortcirc_next.1 ] + br bool %val.1, label %shortcirc_next.1, label %exit.1 + +exit.1: + ret void +} diff --git a/test/LLC/2003-05-27-useboolinotherbb.ll b/test/LLC/2003-05-27-useboolinotherbb.ll new file mode 100644 index 0000000000..ef8b8cc7e9 --- /dev/null +++ b/test/LLC/2003-05-27-useboolinotherbb.ll @@ -0,0 +1,63 @@ +;; Date: May 27, 2003. +;; From: Variant of 2003-05-27-usefsubasbool.ll +;; +;; Error: llc fails to save a boolean value in a register (and later uses an +;; invalid register <NULL VALUE> in a BRNZ) for a boolean value +;; used only by branches but in a different basic block. +;; +;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setCC +;; is used only for branches, it is not saved into an int. register. +;; But if the boolean is used in a branch in a different basic block, +;; that branch uses a BRNZ inst. instead of a branch-on-CC. +;; +;; LLC Output before fix: +;; !****** Outputing Function: QRiterate_1 ****** +;; +;; .section ".text" +;; .align 4 +;; .global QRiterate_1 +;; .type QRiterate_1, 2 +;; QRiterate_1: +;; .L_QRiterate_1_LL_0: +;; save %o6, -192, %o6 +;; sethi %lm(LLVMGlobal__2), %o2 +;; sethi %hh(LLVMGlobal__2), %o1 +;; or %o1, %hm(LLVMGlobal__2), %o1 +;; sllx %o1, 32, %o1 +;; or %o2, %o1, %o2 +;; or %o2, %lo(LLVMGlobal__2), %o2 +;; ldd [%o2+0], %f32 +;; fcmpd %fcc0, %f0, %f32 +;; ba .L_QRiterate_1_LL_1 +;; nop +;; +;; .L_QRiterate_1_LL_1: +;; brnz <NULL_VALUE>, .L_QRiterate_1_LL_1 +;; nop +;; ba .L_QRiterate_1_LL_2 +;; nop +;; +;; .L_QRiterate_1_LL_2: +;; jmpl %i7+8, %g0 +;; restore %g0, 0, %g0 +;; +;; .EndOf_QRiterate_1: +;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 +;; + +target endian = big +target pointersize = 64 + +implementation ; Functions: + +internal void %QRiterate(double %tmp.212) { +entry: ; No predecessors! + %tmp.213 = setne double %tmp.212, 0.000000e+00 + br label %shortcirc_next.1 + +shortcirc_next.1: ; preds = %entry + br bool %tmp.213, label %shortcirc_next.1, label %exit.1 + +exit.1: + ret void +} diff --git a/test/LLC/2003-05-27-usefsubasbool.ll b/test/LLC/2003-05-27-usefsubasbool.ll new file mode 100644 index 0000000000..124b267ca2 --- /dev/null +++ b/test/LLC/2003-05-27-usefsubasbool.ll @@ -0,0 +1,63 @@ +;; Date: May 27, 2003. +;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c +;; Function: Matrix QRiterate(Matrix A, Matrix U) +;; +;; Error: llc produces an invalid register <NULL VALUE> for the +;; a boolean value computed using setne with a double. +;; +;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setne +;; is used for a branch, it can generate a "branch-on-integer-register" +;; for integer registers. In that case, it never saves the value of +;; the boolean result. It was attempting to do the same thing for an +;; FP compare! +;; +;; LLC Output: +;; !****** Outputing Function: QRiterate_1 ****** +;; +;; .section ".text" +;; .align 4 +;; .global QRiterate_1 +;; .type QRiterate_1, 2 +;; QRiterate_1: +;; .L_QRiterate_1_LL_0: +;; save %o6, -192, %o6 +;; sethi %hh(LLVMGlobal__2), %o1 +;; sethi %lm(LLVMGlobal__2), %o0 +;; or %o1, %hm(LLVMGlobal__2), %o1 +;; sllx %o1, 32, %o1 +;; or %o0, %o1, %o0 +;; or %o0, %lo(LLVMGlobal__2), %o0 +;; ldd [%o0+0], %f32 +;; ba .L_QRiterate_1_LL_1 +;; fcmpd %fcc0, %f0, %f32 +;; +;; .L_QRiterate_1_LL_1: +;; brnz <NULL VALUE>, .L_QRiterate_1_LL_1 +;; nop +;; ba .L_QRiterate_1_LL_2 +;; nop +;; +;; .L_QRiterate_1_LL_2: +;; jmpl %i7+8, %g0 +;; restore %g0, 0, %g0 +;; +;; .EndOf_QRiterate_1: +;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 +;; + +target endian = big +target pointersize = 64 + +implementation ; Functions: + +internal void %QRiterate(double %tmp.212) { +entry: ; No predecessors! + br label %shortcirc_next.1 + +shortcirc_next.1: ; preds = %entry + %tmp.213 = setne double %tmp.212, 0.000000e+00 + br bool %tmp.213, label %shortcirc_next.1, label %exit.1 + +exit.1: + ret void +} |