%AConst = constant int 123
+%Domain = type { sbyte*, int, int*, int, int, int*, %Domain* }
+
implementation
; Test setting values of different constants in registers.
end
+;; Test use of a boolean result in cast operations.
+;; Requires converting a condition code result into a 0/1 value in a reg.
+;;
+implementation
+
+int %castbool(int %A, int %B) {
+bb0: ; [#uses=0]
+ %cond213 = setlt int %A, %B ; <bool> [#uses=1]
+ %cast110 = cast bool %cond213 to ubyte ; <ubyte> [#uses=1]
+ %cast109 = cast ubyte %cast110 to int ; <int> [#uses=1]
+ ret int %cast109
+}
+
+
+;; Test use of a boolean result in arithmetic and logical operations.
+;; Requires converting a condition code result into a 0/1 value in a reg.
+;;
+bool %boolexpr(bool %b, int %N) {
+ %b2 = setge int %N, 0
+ %b3 = and bool %b, %b2
+ ret bool %b3
+}
+
+
; Test branch on floating point comparison
;
void "testfloatbool"(float %x, float %y) ; Def %0, %1 - float
bb2: ;;<label>
%reg114 = shl int %N, ubyte 2 ;;
- %cast115 = cast int %reg114 to int* ;; reg114 will be propagated
- %reg116 = add int* %A, %cast115 ;;
- %reg118 = load int* %reg116 ;;
+ %cast115 = cast int %reg114 to long ;; reg114 will be propagated
+ %cast116 = cast int* %A to long ;; %A will be propagated
+ %reg116 = add long %cast116, %cast115 ;;
+ %castPtr = cast long %reg116 to int* ;; %A will be propagated
+ %reg118 = load int* %castPtr ;;
%cast117 = cast int %reg118 to long ;; reg118 will be copied 'cos
%reg159 = add long 1234567, %cast117 ;; cast117 has 2 uses, here
%reg160 = add long 7654321, %cast117 ;; and here.
ret void
end
+
+
+; Test case for folding getelementptr into a load/store
+;
+int "checkFoldGEP"(%Domain* %D, long %idx)
+begin
+ %reg841 = getelementptr %Domain* %D, long 0, ubyte 1
+ %reg820 = load int* %reg841
+ ret int %reg820
+end