llvm.org GIT mirror llvm / ddd5751
Add functions castbool and boolexpr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3448 91177308-0d34-0410-b5e6-96231b3b80d8 Vikram S. Adve 18 years ago
2 changed file(s) with 48 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
107107 end
108108
109109
110 ;; Test use of a boolean result in cast operations.
111 ;; Requires converting a condition code result into a 0/1 value in a reg.
112 ;;
113 implementation
114
115 int %castbool(int %A, int %B) {
116 bb0: ; [#uses=0]
117 %cond213 = setlt int %A, %B ; [#uses=1]
118 %cast110 = cast bool %cond213 to ubyte ; [#uses=1]
119 %cast109 = cast ubyte %cast110 to int ; [#uses=1]
120 ret int %cast109
121 }
122
123
124 ;; Test use of a boolean result in arithmetic and logical operations.
125 ;; Requires converting a condition code result into a 0/1 value in a reg.
126 ;;
127 bool %boolexpr(bool %b, int %N) {
128 %b2 = setge int %N, 0
129 %b3 = and bool %b, %b2
130 ret bool %b3
131 }
132
133
110134 ; Test branch on floating point comparison
111135 ;
112136 void "testfloatbool"(float %x, float %y) ; Def %0, %1 - float
107107 end
108108
109109
110 ;; Test use of a boolean result in cast operations.
111 ;; Requires converting a condition code result into a 0/1 value in a reg.
112 ;;
113 implementation
114
115 int %castbool(int %A, int %B) {
116 bb0: ; [#uses=0]
117 %cond213 = setlt int %A, %B ; [#uses=1]
118 %cast110 = cast bool %cond213 to ubyte ; [#uses=1]
119 %cast109 = cast ubyte %cast110 to int ; [#uses=1]
120 ret int %cast109
121 }
122
123
124 ;; Test use of a boolean result in arithmetic and logical operations.
125 ;; Requires converting a condition code result into a 0/1 value in a reg.
126 ;;
127 bool %boolexpr(bool %b, int %N) {
128 %b2 = setge int %N, 0
129 %b3 = and bool %b, %b2
130 ret bool %b3
131 }
132
133
110134 ; Test branch on floating point comparison
111135 ;
112136 void "testfloatbool"(float %x, float %y) ; Def %0, %1 - float