Add Om1 lowering with no optimizations.
This adds infrastructure for low-level x86-32 instructions, and the target lowering patterns.
Practically no optimizations are performed. Optimizations to be introduced later include liveness analysis, dead-code elimination, global linear-scan register allocation, linear-scan based stack slot coalescing, and compare/branch fusing. One optimization that is present is simple coalescing of stack slots for variables that are only live within a single basic block.
There are also some fairly comprehensive cross tests. This testing infrastructure translates bitcode using both Subzero and llc, and a testing harness calls both versions with a variety of "interesting" inputs and compares the results. Specifically, Arithmetic, Icmp, Fcmp, and Cast instructions are tested this way, across all PNaCl primitive types.
BUG=
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/265703002
diff --git a/tests_lit/llvm2ice_tests/64bit.pnacl.ll b/tests_lit/llvm2ice_tests/64bit.pnacl.ll
index 761f388..1ca8077 100644
--- a/tests_lit/llvm2ice_tests/64bit.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/64bit.pnacl.ll
@@ -1,5 +1,10 @@
-; RUIN: %llvm2ice --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This tries to be a comprehensive test of i64 operations, in
+; particular the patterns for lowering i64 operations into constituent
+; i32 operations on x86-32.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -40,6 +45,24 @@
; CHECK-NEXT: push
; CHECK-NEXT: push
; CHECK-NEXT: call ignore64BitArgNoInline
+;
+; OPTM1: pass64BitArg:
+; OPTM1: push 123
+; OPTM1-NEXT: push
+; OPTM1-NEXT: push
+; OPTM1-NEXT: call ignore64BitArgNoInline
+; OPTM1: push
+; OPTM1-NEXT: push
+; OPTM1-NEXT: push 123
+; OPTM1-NEXT: push
+; OPTM1-NEXT: push
+; OPTM1-NEXT: call ignore64BitArgNoInline
+; OPTM1: push
+; OPTM1-NEXT: push
+; OPTM1-NEXT: push 123
+; OPTM1-NEXT: push
+; OPTM1-NEXT: push
+; OPTM1-NEXT: call ignore64BitArgNoInline
declare i32 @ignore64BitArgNoInline(i64, i32, i64)
@@ -55,6 +78,14 @@
; CHECK-NEXT: push ecx
; CHECK-NEXT: push eax
; CHECK-NEXT: call ignore64BitArgNoInline
+;
+; OPTM1: pass64BitConstArg:
+; OPTM1: push 3735928559
+; OPTM1-NEXT: push 305419896
+; OPTM1-NEXT: push 123
+; OPTM1-NEXT: push dword ptr [
+; OPTM1-NEXT: push dword ptr [
+; OPTM1-NEXT: call ignore64BitArgNoInline
define internal i64 @return64BitArg(i64 %a) {
entry:
@@ -64,6 +95,11 @@
; CHECK: mov {{.*}}, dword ptr [esp+4]
; CHECK: mov {{.*}}, dword ptr [esp+8]
; CHECK: ret
+;
+; OPTM1: return64BitArg:
+; OPTM1: mov {{.*}}, dword ptr [esp+4]
+; OPTM1: mov {{.*}}, dword ptr [esp+8]
+; OPTM1: ret
define internal i64 @return64BitConst() {
entry:
@@ -73,6 +109,11 @@
; CHECK: mov eax, 305419896
; CHECK: mov edx, 3735928559
; CHECK: ret
+;
+; OPTM1: return64BitConst:
+; OPTM1: mov eax, 305419896
+; OPTM1: mov edx, 3735928559
+; OPTM1: ret
define internal i64 @add64BitSigned(i64 %a, i64 %b) {
entry:
@@ -83,6 +124,11 @@
; CHECK: add
; CHECK: adc
; CHECK: ret
+;
+; OPTM1: add64BitSigned:
+; OPTM1: add
+; OPTM1: adc
+; OPTM1: ret
define internal i64 @add64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -93,6 +139,11 @@
; CHECK: add
; CHECK: adc
; CHECK: ret
+;
+; OPTM1: add64BitUnsigned:
+; OPTM1: add
+; OPTM1: adc
+; OPTM1: ret
define internal i64 @sub64BitSigned(i64 %a, i64 %b) {
entry:
@@ -103,6 +154,11 @@
; CHECK: sub
; CHECK: sbb
; CHECK: ret
+;
+; OPTM1: sub64BitSigned:
+; OPTM1: sub
+; OPTM1: sbb
+; OPTM1: ret
define internal i64 @sub64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -113,6 +169,11 @@
; CHECK: sub
; CHECK: sbb
; CHECK: ret
+;
+; OPTM1: sub64BitUnsigned:
+; OPTM1: sub
+; OPTM1: sbb
+; OPTM1: ret
define internal i64 @mul64BitSigned(i64 %a, i64 %b) {
entry:
@@ -126,6 +187,14 @@
; CHECK: add
; CHECK: add
; CHECK: ret
+;
+; OPTM1: mul64BitSigned:
+; OPTM1: imul
+; OPTM1: imul
+; OPTM1: mul
+; OPTM1: add
+; OPTM1: add
+; OPTM1: ret
define internal i64 @mul64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -139,6 +208,14 @@
; CHECK: add
; CHECK: add
; CHECK: ret
+;
+; OPTM1: mul64BitUnsigned:
+; OPTM1: imul
+; OPTM1: imul
+; OPTM1: mul
+; OPTM1: add
+; OPTM1: add
+; OPTM1: ret
define internal i64 @div64BitSigned(i64 %a, i64 %b) {
entry:
@@ -148,6 +225,10 @@
; CHECK: div64BitSigned:
; CHECK: call __divdi3
; CHECK: ret
+;
+; OPTM1: div64BitSigned:
+; OPTM1: call __divdi3
+; OPTM1: ret
define internal i64 @div64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -157,6 +238,10 @@
; CHECK: div64BitUnsigned:
; CHECK: call __udivdi3
; CHECK: ret
+;
+; OPTM1: div64BitUnsigned:
+; OPTM1: call __udivdi3
+; OPTM1: ret
define internal i64 @rem64BitSigned(i64 %a, i64 %b) {
entry:
@@ -166,6 +251,10 @@
; CHECK: rem64BitSigned:
; CHECK: call __moddi3
; CHECK: ret
+;
+; OPTM1: rem64BitSigned:
+; OPTM1: call __moddi3
+; OPTM1: ret
define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -175,6 +264,10 @@
; CHECK: rem64BitUnsigned:
; CHECK: call __umoddi3
; CHECK: ret
+;
+; OPTM1: rem64BitUnsigned:
+; OPTM1: call __umoddi3
+; OPTM1: ret
define internal i64 @shl64BitSigned(i64 %a, i64 %b) {
entry:
@@ -186,6 +279,12 @@
; CHECK: shl e
; CHECK: test {{.*}}, 32
; CHECK: je
+;
+; OPTM1: shl64BitSigned:
+; OPTM1: shld
+; OPTM1: shl e
+; OPTM1: test {{.*}}, 32
+; OPTM1: je
define internal i64 @shl64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -197,6 +296,12 @@
; CHECK: shl e
; CHECK: test {{.*}}, 32
; CHECK: je
+;
+; OPTM1: shl64BitUnsigned:
+; OPTM1: shld
+; OPTM1: shl e
+; OPTM1: test {{.*}}, 32
+; OPTM1: je
define internal i64 @shr64BitSigned(i64 %a, i64 %b) {
entry:
@@ -209,6 +314,13 @@
; CHECK: test {{.*}}, 32
; CHECK: je
; CHECK: sar {{.*}}, 31
+;
+; OPTM1: shr64BitSigned:
+; OPTM1: shrd
+; OPTM1: sar
+; OPTM1: test {{.*}}, 32
+; OPTM1: je
+; OPTM1: sar {{.*}}, 31
define internal i64 @shr64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -220,6 +332,12 @@
; CHECK: shr
; CHECK: test {{.*}}, 32
; CHECK: je
+;
+; OPTM1: shr64BitUnsigned:
+; OPTM1: shrd
+; OPTM1: shr
+; OPTM1: test {{.*}}, 32
+; OPTM1: je
define internal i64 @and64BitSigned(i64 %a, i64 %b) {
entry:
@@ -229,6 +347,10 @@
; CHECK: and64BitSigned:
; CHECK: and
; CHECK: and
+;
+; OPTM1: and64BitSigned:
+; OPTM1: and
+; OPTM1: and
define internal i64 @and64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -238,6 +360,10 @@
; CHECK: and64BitUnsigned:
; CHECK: and
; CHECK: and
+;
+; OPTM1: and64BitUnsigned:
+; OPTM1: and
+; OPTM1: and
define internal i64 @or64BitSigned(i64 %a, i64 %b) {
entry:
@@ -247,6 +373,10 @@
; CHECK: or64BitSigned:
; CHECK: or
; CHECK: or
+;
+; OPTM1: or64BitSigned:
+; OPTM1: or
+; OPTM1: or
define internal i64 @or64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -256,6 +386,10 @@
; CHECK: or64BitUnsigned:
; CHECK: or
; CHECK: or
+;
+; OPTM1: or64BitUnsigned:
+; OPTM1: or
+; OPTM1: or
define internal i64 @xor64BitSigned(i64 %a, i64 %b) {
entry:
@@ -265,6 +399,10 @@
; CHECK: xor64BitSigned:
; CHECK: xor
; CHECK: xor
+;
+; OPTM1: xor64BitSigned:
+; OPTM1: xor
+; OPTM1: xor
define internal i64 @xor64BitUnsigned(i64 %a, i64 %b) {
entry:
@@ -274,6 +412,10 @@
; CHECK: xor64BitUnsigned:
; CHECK: xor
; CHECK: xor
+;
+; OPTM1: xor64BitUnsigned:
+; OPTM1: xor
+; OPTM1: xor
define internal i32 @trunc64To32Signed(i64 %a) {
entry:
@@ -283,6 +425,10 @@
; CHECK: trunc64To32Signed:
; CHECK: mov eax, dword ptr [esp+4]
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To32Signed:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: ret
define internal i32 @trunc64To16Signed(i64 %a) {
entry:
@@ -294,6 +440,11 @@
; CHECK: mov eax, dword ptr [esp+4]
; CHECK-NEXT: movsx eax, ax
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To16Signed:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: movsx eax,
+; OPTM1: ret
define internal i32 @trunc64To8Signed(i64 %a) {
entry:
@@ -305,6 +456,11 @@
; CHECK: mov eax, dword ptr [esp+4]
; CHECK-NEXT: movsx eax, al
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To8Signed:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: movsx eax,
+; OPTM1: ret
define internal i32 @trunc64To32Unsigned(i64 %a) {
entry:
@@ -314,6 +470,10 @@
; CHECK: trunc64To32Unsigned:
; CHECK: mov eax, dword ptr [esp+4]
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To32Unsigned:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: ret
define internal i32 @trunc64To16Unsigned(i64 %a) {
entry:
@@ -325,6 +485,11 @@
; CHECK: mov eax, dword ptr [esp+4]
; CHECK-NEXT: movzx eax, ax
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To16Unsigned:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: movzx eax,
+; OPTM1: ret
define internal i32 @trunc64To8Unsigned(i64 %a) {
entry:
@@ -336,6 +501,11 @@
; CHECK: mov eax, dword ptr [esp+4]
; CHECK-NEXT: movzx eax, al
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To8Unsigned:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: movzx eax,
+; OPTM1: ret
define internal i32 @trunc64To1(i64 %a) {
entry:
@@ -348,6 +518,11 @@
; CHECK: mov eax, dword ptr [esp+4]
; CHECK: and eax, 1
; CHECK-NEXT: ret
+;
+; OPTM1: trunc64To1:
+; OPTM1: mov eax, dword ptr [esp+
+; OPTM1: and eax, 1
+; OPTM1: ret
define internal i64 @sext32To64(i32 %a) {
entry:
@@ -357,6 +532,10 @@
; CHECK: sext32To64:
; CHECK: mov
; CHECK: sar {{.*}}, 31
+;
+; OPTM1: sext32To64:
+; OPTM1: mov
+; OPTM1: sar {{.*}}, 31
define internal i64 @sext16To64(i32 %a) {
entry:
@@ -367,6 +546,10 @@
; CHECK: sext16To64:
; CHECK: movsx
; CHECK: sar {{.*}}, 31
+;
+; OPTM1: sext16To64:
+; OPTM1: movsx
+; OPTM1: sar {{.*}}, 31
define internal i64 @sext8To64(i32 %a) {
entry:
@@ -377,6 +560,10 @@
; CHECK: sext8To64:
; CHECK: movsx
; CHECK: sar {{.*}}, 31
+;
+; OPTM1: sext8To64:
+; OPTM1: movsx
+; OPTM1: sar {{.*}}, 31
define internal i64 @zext32To64(i32 %a) {
entry:
@@ -386,6 +573,10 @@
; CHECK: zext32To64:
; CHECK: mov
; CHECK: mov {{.*}}, 0
+;
+; OPTM1: zext32To64:
+; OPTM1: mov
+; OPTM1: mov {{.*}}, 0
define internal i64 @zext16To64(i32 %a) {
entry:
@@ -396,6 +587,10 @@
; CHECK: zext16To64:
; CHECK: movzx
; CHECK: mov {{.*}}, 0
+;
+; OPTM1: zext16To64:
+; OPTM1: movzx
+; OPTM1: mov {{.*}}, 0
define internal i64 @zext8To64(i32 %a) {
entry:
@@ -406,6 +601,10 @@
; CHECK: zext8To64:
; CHECK: movzx
; CHECK: mov {{.*}}, 0
+;
+; OPTM1: zext8To64:
+; OPTM1: movzx
+; OPTM1: mov {{.*}}, 0
define internal i64 @zext1To64(i32 %a) {
entry:
@@ -416,6 +615,10 @@
; CHECK: zext1To64:
; CHECK: movzx
; CHECK: mov {{.*}}, 0
+;
+; OPTM1: zext1To64:
+; OPTM1: movzx
+; OPTM1: mov {{.*}}, 0
define internal void @icmpEq64(i64 %a, i64 %b, i64 %c, i64 %d) {
entry:
@@ -444,6 +647,14 @@
; CHECK: jne
; CHECK: jne
; CHECK: call
+;
+; OPTM1: icmpEq64:
+; OPTM1: jne
+; OPTM1: jne
+; OPTM1: call
+; OPTM1: jne
+; OPTM1: jne
+; OPTM1: call
declare void @func()
@@ -474,6 +685,14 @@
; CHECK: jne
; CHECK: jne
; CHECK: call
+;
+; OPTM1: icmpNe64:
+; OPTM1: jne
+; OPTM1: jne
+; OPTM1: call
+; OPTM1: jne
+; OPTM1: jne
+; OPTM1: call
define internal void @icmpGt64(i64 %a, i64 %b, i64 %c, i64 %d) {
entry:
@@ -504,6 +723,16 @@
; CHECK: jl
; CHECK: ja
; CHECK: call
+;
+; OPTM1: icmpGt64:
+; OPTM1: ja
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: call
+; OPTM1: jg
+; OPTM1: jl
+; OPTM1: ja
+; OPTM1: call
define internal void @icmpGe64(i64 %a, i64 %b, i64 %c, i64 %d) {
entry:
@@ -534,6 +763,16 @@
; CHECK: jl
; CHECK: jae
; CHECK: call
+;
+; OPTM1: icmpGe64:
+; OPTM1: ja
+; OPTM1: jb
+; OPTM1: jae
+; OPTM1: call
+; OPTM1: jg
+; OPTM1: jl
+; OPTM1: jae
+; OPTM1: call
define internal void @icmpLt64(i64 %a, i64 %b, i64 %c, i64 %d) {
entry:
@@ -564,6 +803,16 @@
; CHECK: jg
; CHECK: jb
; CHECK: call
+;
+; OPTM1: icmpLt64:
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: jb
+; OPTM1: call
+; OPTM1: jl
+; OPTM1: jg
+; OPTM1: jb
+; OPTM1: call
define internal void @icmpLe64(i64 %a, i64 %b, i64 %c, i64 %d) {
entry:
@@ -594,6 +843,16 @@
; CHECK: jg
; CHECK: jbe
; CHECK: call
+;
+; OPTM1: icmpLe64:
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: jbe
+; OPTM1: call
+; OPTM1: jl
+; OPTM1: jg
+; OPTM1: jbe
+; OPTM1: call
define internal i32 @icmpEq64Bool(i64 %a, i64 %b) {
entry:
@@ -604,6 +863,10 @@
; CHECK: icmpEq64Bool:
; CHECK: jne
; CHECK: jne
+;
+; OPTM1: icmpEq64Bool:
+; OPTM1: jne
+; OPTM1: jne
define internal i32 @icmpNe64Bool(i64 %a, i64 %b) {
entry:
@@ -614,6 +877,10 @@
; CHECK: icmpNe64Bool:
; CHECK: jne
; CHECK: jne
+;
+; OPTM1: icmpNe64Bool:
+; OPTM1: jne
+; OPTM1: jne
define internal i32 @icmpSgt64Bool(i64 %a, i64 %b) {
entry:
@@ -627,6 +894,13 @@
; CHECK: jl
; CHECK: cmp
; CHECK: ja
+;
+; OPTM1: icmpSgt64Bool:
+; OPTM1: cmp
+; OPTM1: jg
+; OPTM1: jl
+; OPTM1: cmp
+; OPTM1: ja
define internal i32 @icmpUgt64Bool(i64 %a, i64 %b) {
entry:
@@ -640,6 +914,13 @@
; CHECK: jb
; CHECK: cmp
; CHECK: ja
+;
+; OPTM1: icmpUgt64Bool:
+; OPTM1: cmp
+; OPTM1: ja
+; OPTM1: jb
+; OPTM1: cmp
+; OPTM1: ja
define internal i32 @icmpSge64Bool(i64 %a, i64 %b) {
entry:
@@ -653,6 +934,13 @@
; CHECK: jl
; CHECK: cmp
; CHECK: jae
+;
+; OPTM1: icmpSge64Bool:
+; OPTM1: cmp
+; OPTM1: jg
+; OPTM1: jl
+; OPTM1: cmp
+; OPTM1: jae
define internal i32 @icmpUge64Bool(i64 %a, i64 %b) {
entry:
@@ -666,6 +954,13 @@
; CHECK: jb
; CHECK: cmp
; CHECK: jae
+;
+; OPTM1: icmpUge64Bool:
+; OPTM1: cmp
+; OPTM1: ja
+; OPTM1: jb
+; OPTM1: cmp
+; OPTM1: jae
define internal i32 @icmpSlt64Bool(i64 %a, i64 %b) {
entry:
@@ -679,6 +974,13 @@
; CHECK: jg
; CHECK: cmp
; CHECK: jb
+;
+; OPTM1: icmpSlt64Bool:
+; OPTM1: cmp
+; OPTM1: jl
+; OPTM1: jg
+; OPTM1: cmp
+; OPTM1: jb
define internal i32 @icmpUlt64Bool(i64 %a, i64 %b) {
entry:
@@ -692,6 +994,13 @@
; CHECK: ja
; CHECK: cmp
; CHECK: jb
+;
+; OPTM1: icmpUlt64Bool:
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: cmp
+; OPTM1: jb
define internal i32 @icmpSle64Bool(i64 %a, i64 %b) {
entry:
@@ -705,6 +1014,13 @@
; CHECK: jg
; CHECK: cmp
; CHECK: jbe
+;
+; OPTM1: icmpSle64Bool:
+; OPTM1: cmp
+; OPTM1: jl
+; OPTM1: jg
+; OPTM1: cmp
+; OPTM1: jbe
define internal i32 @icmpUle64Bool(i64 %a, i64 %b) {
entry:
@@ -718,6 +1034,13 @@
; CHECK: ja
; CHECK: cmp
; CHECK: jbe
+;
+; OPTM1: icmpUle64Bool:
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: cmp
+; OPTM1: jbe
define internal i64 @load64(i32 %a) {
entry:
@@ -729,6 +1052,10 @@
; CHECK: mov e[[REGISTER:[a-z]+]], dword ptr [esp+4]
; CHECK-NEXT: mov {{.*}}, dword ptr [e[[REGISTER]]]
; CHECK-NEXT: mov {{.*}}, dword ptr [e[[REGISTER]]+4]
+;
+; OPTM1: load64:
+; OPTM1: mov e{{..}}, dword ptr [e{{..}}]
+; OPTM1: mov e{{..}}, dword ptr [e{{..}}+4]
define internal void @store64(i32 %a, i64 %value) {
entry:
@@ -740,6 +1067,10 @@
; CHECK: mov e[[REGISTER:[a-z]+]], dword ptr [esp+4]
; CHECK: mov dword ptr [e[[REGISTER]]+4],
; CHECK: mov dword ptr [e[[REGISTER]]],
+;
+; OPTM1: store64:
+; OPTM1: mov dword ptr [e[[REGISTER:[a-z]+]]+4],
+; OPTM1: mov dword ptr [e[[REGISTER]]],
define internal void @store64Const(i32 %a) {
entry:
@@ -751,6 +1082,10 @@
; CHECK: mov e[[REGISTER:[a-z]+]], dword ptr [esp+4]
; CHECK: mov dword ptr [e[[REGISTER]]+4], 3735928559
; CHECK: mov dword ptr [e[[REGISTER]]], 305419896
+;
+; OPTM1: store64Const:
+; OPTM1: mov dword ptr [e[[REGISTER:[a-z]+]]+4], 3735928559
+; OPTM1: mov dword ptr [e[[REGISTER]]], 305419896
define internal i64 @select64VarVar(i64 %a, i64 %b) {
entry:
@@ -766,6 +1101,15 @@
; CHECK: jb
; CHECK: cmp
; CHECK: jne
+;
+; OPTM1: select64VarVar:
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: cmp
+; OPTM1: jne
define internal i64 @select64VarConst(i64 %a, i64 %b) {
entry:
@@ -781,6 +1125,15 @@
; CHECK: jb
; CHECK: cmp
; CHECK: jne
+;
+; OPTM1: select64VarConst:
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: cmp
+; OPTM1: jne
define internal i64 @select64ConstVar(i64 %a, i64 %b) {
entry:
@@ -796,6 +1149,15 @@
; CHECK: jb
; CHECK: cmp
; CHECK: jne
+;
+; OPTM1: select64ConstVar:
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: ja
+; OPTM1: cmp
+; OPTM1: jb
+; OPTM1: cmp
+; OPTM1: jne
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/alloc.ll b/tests_lit/llvm2ice_tests/alloc.ll
index b2f90e4..d9da106 100644
--- a/tests_lit/llvm2ice_tests/alloc.ll
+++ b/tests_lit/llvm2ice_tests/alloc.ll
@@ -1,5 +1,9 @@
-; RUIN: %llvm2ice --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This is a basic test of the alloca instruction - one test for alloca
+; of a fixed size, and one test for variable size.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -10,11 +14,18 @@
%__2 = ptrtoint i8* %array to i32
call void @f1(i32 %__2)
ret void
- ; CHECK: sub esp, 400
- ; CHECK-NEXT: mov eax, esp
- ; CHECK-NEXT: push eax
- ; CHECK-NEXT: call f1
}
+; CHECK: fixed_400:
+; CHECK: sub esp, 400
+; CHECK-NEXT: mov eax, esp
+; CHECK-NEXT: push eax
+; CHECK-NEXT: call f1
+;
+; OPTM1: fixed_400:
+; OPTM1: sub esp, 400
+; OPTM1-NEXT: mov {{.*}}, esp
+; OPTM1: push
+; OPTM1-NEXT: call f1
declare void @f1(i32)
@@ -24,12 +35,18 @@
%__2 = ptrtoint i8* %array to i32
call void @f2(i32 %__2)
ret void
- ; CHECK: mov eax, dword ptr [ebp+8]
- ; CHECK-NEXT: sub esp, eax
- ; CHECK-NEXT: mov eax, esp
- ; CHECK-NEXT: push eax
- ; CHECK-NEXT: call f2
}
+; CHECK: variable_n:
+; CHECK: mov eax, dword ptr [ebp+8]
+; CHECK-NEXT: sub esp, eax
+; CHECK-NEXT: mov eax, esp
+; CHECK-NEXT: push eax
+; CHECK-NEXT: call f2
+;
+; OPTM1: variable_n:
+; OPTM1: mov {{.*}}, esp
+; OPTM1: push
+; OPTM1-NEXT: call f2
declare void @f2(i32)
diff --git a/tests_lit/llvm2ice_tests/arith-opt.ll b/tests_lit/llvm2ice_tests/arith-opt.ll
index f080125..fff8e3f 100644
--- a/tests_lit/llvm2ice_tests/arith-opt.ll
+++ b/tests_lit/llvm2ice_tests/arith-opt.ll
@@ -1,5 +1,8 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This is a very early test that just checks the representation of i32
+; arithmetic instructions. No assembly tests are done.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/arithmetic-chain.ll b/tests_lit/llvm2ice_tests/arithmetic-chain.ll
index 2609ef7..01ec91a 100644
--- a/tests_lit/llvm2ice_tests/arithmetic-chain.ll
+++ b/tests_lit/llvm2ice_tests/arithmetic-chain.ll
@@ -1,5 +1,9 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This is a very early test that just checks the representation of
+; arithmetic instructions, i64, variables, and constants. No assembly
+; tests are done.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/bitcast.ll b/tests_lit/llvm2ice_tests/bitcast.ll
index c180c87..8c9a936 100644
--- a/tests_lit/llvm2ice_tests/bitcast.ll
+++ b/tests_lit/llvm2ice_tests/bitcast.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Trivial smoke test of bitcast between integer and FP types.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -7,24 +9,28 @@
define internal i32 @cast_f2i(float %f) {
entry:
%v0 = bitcast float %f to i32
+; CHECK: bitcast
ret i32 %v0
}
define internal float @cast_i2f(i32 %i) {
entry:
%v0 = bitcast i32 %i to float
+; CHECK: bitcast
ret float %v0
}
define internal i64 @cast_d2ll(double %d) {
entry:
%v0 = bitcast double %d to i64
+; CHECK: bitcast
ret i64 %v0
}
define internal double @cast_ll2d(i64 %ll) {
entry:
%v0 = bitcast i64 %ll to double
+; CHECK: bitcast
ret double %v0
}
diff --git a/tests_lit/llvm2ice_tests/bool-opt.ll b/tests_lit/llvm2ice_tests/bool-opt.ll
index 3078615..1ccdeb6 100644
--- a/tests_lit/llvm2ice_tests/bool-opt.ll
+++ b/tests_lit/llvm2ice_tests/bool-opt.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Trivial smoke test of icmp without fused branch opportunity.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/branch-simple.ll b/tests_lit/llvm2ice_tests/branch-simple.ll
index 201238e..6702790 100644
--- a/tests_lit/llvm2ice_tests/branch-simple.ll
+++ b/tests_lit/llvm2ice_tests/branch-simple.ll
@@ -1,5 +1,8 @@
-; RUIN: %llvm2ice %s -verbose inst | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Trivial smoke test of compare and branch, with multiple basic
+; blocks.
+
+; RUN: %llvm2ice %s --verbose inst | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/call.ll b/tests_lit/llvm2ice_tests/call.ll
index c029789..41dcf09 100644
--- a/tests_lit/llvm2ice_tests/call.ll
+++ b/tests_lit/llvm2ice_tests/call.ll
@@ -1,5 +1,8 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple smoke test of the call instruction. The assembly checks
+; currently only verify the function labels.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -49,6 +52,7 @@
define void @call_void(i32 %n) {
; CHECK: define void @call_void
+
entry:
%cmp2 = icmp sgt i32 %n, 0
br i1 %cmp2, label %if.then, label %if.end
diff --git a/tests_lit/llvm2ice_tests/callindirect.pnacl.ll b/tests_lit/llvm2ice_tests/callindirect.pnacl.ll
index 10b0aba..0112a5b 100644
--- a/tests_lit/llvm2ice_tests/callindirect.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/callindirect.pnacl.ll
@@ -1,5 +1,10 @@
-; RUIN: %llvm2ice --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Test of multiple indirect calls to the same target. Each call
+; should be to the same operand, whether it's in a register or on the
+; stack.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -24,6 +29,12 @@
; CHECK: call [[REGISTER]]
; CHECK: call [[REGISTER]]
; CHECK: call [[REGISTER]]
+;
+; OPTM1: call [[TARGET:.+]]
+; OPTM1: call [[TARGET]]
+; OPTM1: call [[TARGET]]
+; OPTM1: call [[TARGET]]
+; OPTM1: call [[TARGET]]
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/casts.ll b/tests_lit/llvm2ice_tests/casts.ll
index 0849fb2..a75cd51 100644
--- a/tests_lit/llvm2ice_tests/casts.ll
+++ b/tests_lit/llvm2ice_tests/casts.ll
@@ -1,5 +1,5 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/cmp-opt.ll b/tests_lit/llvm2ice_tests/cmp-opt.ll
index 124630d..0dd2a80 100644
--- a/tests_lit/llvm2ice_tests/cmp-opt.ll
+++ b/tests_lit/llvm2ice_tests/cmp-opt.ll
@@ -1,5 +1,8 @@
-; RUIN: %llvm2ice %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple test of non-fused compare/branch.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -27,8 +30,6 @@
declare void @use(i1 zeroext)
-; ERRORS-NOT: ICE translation error
-
; CHECK: .globl testBool
; Two bool computations
; CHECK: cmp
@@ -40,4 +41,18 @@
; CHECK: cmp
; CHECK: call
; CHECK: ret
+;
+; OPTM1: .globl testBool
+; Two bool computations
+; OPTM1: cmp
+; OPTM1: cmp
+; Test first bool
+; OPTM1: cmp
+; OPTM1: call
+; Test second bool
+; OPTM1: cmp
+; OPTM1: call
+; OPTM1: ret
+
+; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/convert.ll b/tests_lit/llvm2ice_tests/convert.ll
index b5655cc..1b61db3 100644
--- a/tests_lit/llvm2ice_tests/convert.ll
+++ b/tests_lit/llvm2ice_tests/convert.ll
@@ -1,5 +1,8 @@
-; RUIN: %llvm2ice %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple test of signed and unsigned integer conversions.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -27,16 +30,27 @@
%__7 = bitcast [8 x i8]* @i64v to i64*
store i64 %v3, i64* %__7, align 1
ret void
- ; CHECK: mov al, byte ptr [
- ; CHECK-NEXT: movsx cx, al
- ; CHECK-NEXT: mov word ptr [
- ; CHECK-NEXT: movsx ecx, al
- ; CHECK-NEXT: mov dword ptr [
- ; CHECK-NEXT: movsx ecx, al
- ; CHECK-NEXT: sar eax, 31
- ; CHECK-NEXT: mov dword ptr [i64v+4],
- ; CHECK-NEXT: mov dword ptr [i64v],
}
+; CHECK: from_int8:
+; CHECK: mov al, byte ptr [
+; CHECK-NEXT: movsx cx, al
+; CHECK-NEXT: mov word ptr [
+; CHECK-NEXT: movsx ecx, al
+; CHECK-NEXT: mov dword ptr [
+; CHECK-NEXT: movsx ecx, al
+; CHECK-NEXT: sar eax, 31
+; CHECK-NEXT: mov dword ptr [i64v+4],
+; CHECK-NEXT: mov dword ptr [i64v],
+;
+; OPTM1: from_int8:
+; OPTM1: mov {{.*}}, byte ptr [
+; OPTM1: movsx
+; OPTM1: mov word ptr [
+; OPTM1: movsx
+; OPTM1: mov dword ptr [
+; OPTM1: movsx
+; OPTM1: sar {{.*}}, 31
+; OPTM1: i64v
define void @from_int16() {
entry:
@@ -52,16 +66,26 @@
%__7 = bitcast [8 x i8]* @i64v to i64*
store i64 %v3, i64* %__7, align 1
ret void
- ; CHECK: mov ax, word ptr [
- ; CHECK-NEXT: mov cx, ax
- ; CHECK-NEXT: mov byte ptr [
- ; CHECK-NEXT: movsx ecx, ax
- ; CHECK-NEXT: mov dword ptr [
- ; CHECK-NEXT: movsx ecx, ax
- ; CHECK-NEXT: sar eax, 31
- ; CHECK-NEXT: mov dword ptr [i64v+4],
- ; CHECK-NEXT: mov dword ptr [i64v],
}
+; CHECK: from_int16:
+; CHECK: mov ax, word ptr [
+; CHECK-NEXT: mov cx, ax
+; CHECK-NEXT: mov byte ptr [
+; CHECK-NEXT: movsx ecx, ax
+; CHECK-NEXT: mov dword ptr [
+; CHECK-NEXT: movsx ecx, ax
+; CHECK-NEXT: sar eax, 31
+; CHECK-NEXT: mov dword ptr [i64v+4],
+; CHECK-NEXT: mov dword ptr [i64v],
+;
+; OPTM1: from_int16:
+; OPTM1: mov {{.*}}, word ptr [
+; OPTM1: i8v
+; OPTM1: movsx
+; OPTM1: i32v
+; OPTM1: movsx
+; OPTM1: sar {{.*}}, 31
+; OPTM1: i64v
define void @from_int32() {
entry:
@@ -77,16 +101,24 @@
%__7 = bitcast [8 x i8]* @i64v to i64*
store i64 %v3, i64* %__7, align 1
ret void
- ; CHECK: mov eax, dword ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov byte ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov word ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: sar eax, 31
- ; CHECK-NEXT: mov dword ptr [i64v+4],
- ; CHECK-NEXT: mov dword ptr [i64v],
}
+; CHECK: from_int32:
+; CHECK: mov eax, dword ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov byte ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov word ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: sar eax, 31
+; CHECK-NEXT: mov dword ptr [i64v+4],
+; CHECK-NEXT: mov dword ptr [i64v],
+;
+; OPTM1: from_int32:
+; OPTM1: i32v
+; OPTM1: i8v
+; OPTM1: i16v
+; OPTM1: sar {{.*}}, 31
+; OPTM1: i64v
define void @from_int64() {
entry:
@@ -102,13 +134,20 @@
%__7 = bitcast [4 x i8]* @i32v to i32*
store i32 %v3, i32* %__7, align 1
ret void
- ; CHECK: mov eax, dword ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov byte ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov word ptr [
- ; CHECK-NEXT: mov dword ptr [
}
+; CHECK: from_int64:
+; CHECK: mov eax, dword ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov byte ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov word ptr [
+; CHECK-NEXT: mov dword ptr [
+;
+; OPTM1: from_int64:
+; OPTM1: i64v
+; OPTM1: i8v
+; OPTM1: i16v
+; OPTM1: i32v
define void @from_uint8() {
entry:
@@ -124,16 +163,27 @@
%__7 = bitcast [8 x i8]* @i64v to i64*
store i64 %v3, i64* %__7, align 1
ret void
- ; CHECK: mov al, byte ptr [
- ; CHECK-NEXT: movzx cx, al
- ; CHECK-NEXT: mov word ptr [
- ; CHECK-NEXT: movzx ecx, al
- ; CHECK-NEXT: mov dword ptr [
- ; CHECK-NEXT: movzx eax, al
- ; CHECK-NEXT: mov ecx, 0
- ; CHECK-NEXT: mov dword ptr [i64v+4],
- ; CHECK-NEXT: mov dword ptr [i64v],
}
+; CHECK: from_uint8:
+; CHECK: mov al, byte ptr [
+; CHECK-NEXT: movzx cx, al
+; CHECK-NEXT: mov word ptr [
+; CHECK-NEXT: movzx ecx, al
+; CHECK-NEXT: mov dword ptr [
+; CHECK-NEXT: movzx eax, al
+; CHECK-NEXT: mov ecx, 0
+; CHECK-NEXT: mov dword ptr [i64v+4],
+; CHECK-NEXT: mov dword ptr [i64v],
+;
+; OPTM1: from_uint8:
+; OPTM1: u8v
+; OPTM1: movzx
+; OPTM1: i16v
+; OPTM1: movzx
+; OPTM1: i32v
+; OPTM1: movzx
+; OPTM1: mov {{.*}}, 0
+; OPTM1: i64v
define void @from_uint16() {
entry:
@@ -149,16 +199,26 @@
%__7 = bitcast [8 x i8]* @i64v to i64*
store i64 %v3, i64* %__7, align 1
ret void
- ; CHECK: mov ax, word ptr [
- ; CHECK-NEXT: mov cx, ax
- ; CHECK-NEXT: mov byte ptr [
- ; CHECK-NEXT: movzx ecx, ax
- ; CHECK-NEXT: mov dword ptr [
- ; CHECK-NEXT: movzx eax, ax
- ; CHECK-NEXT: mov ecx, 0
- ; CHECK-NEXT: mov dword ptr [i64v+4],
- ; CHECK-NEXT: mov dword ptr [i64v],
}
+; CHECK: from_uint16:
+; CHECK: mov ax, word ptr [
+; CHECK-NEXT: mov cx, ax
+; CHECK-NEXT: mov byte ptr [
+; CHECK-NEXT: movzx ecx, ax
+; CHECK-NEXT: mov dword ptr [
+; CHECK-NEXT: movzx eax, ax
+; CHECK-NEXT: mov ecx, 0
+; CHECK-NEXT: mov dword ptr [i64v+4],
+; CHECK-NEXT: mov dword ptr [i64v],
+;
+; OPTM1: from_uint16:
+; OPTM1: u16v
+; OPTM1: i8v
+; OPTM1: movzx
+; OPTM1: i32v
+; OPTM1: movzx
+; OPTM1: mov {{.*}}, 0
+; OPTM1: i64v
define void @from_uint32() {
entry:
@@ -174,15 +234,23 @@
%__7 = bitcast [8 x i8]* @i64v to i64*
store i64 %v3, i64* %__7, align 1
ret void
- ; CHECK: mov eax, dword ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov byte ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov word ptr [
- ; CHECK-NEXT: mov ecx, 0
- ; CHECK-NEXT: mov dword ptr [i64v+4],
- ; CHECK-NEXT: mov dword ptr [i64v],
}
+; CHECK: from_uint32:
+; CHECK: mov eax, dword ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov byte ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov word ptr [
+; CHECK-NEXT: mov ecx, 0
+; CHECK-NEXT: mov dword ptr [i64v+4],
+; CHECK-NEXT: mov dword ptr [i64v],
+;
+; OPTM1: from_uint32:
+; OPTM1: u32v
+; OPTM1: i8v
+; OPTM1: i16v
+; OPTM1: mov {{.*}}, 0
+; OPTM1: i64v
define void @from_uint64() {
entry:
@@ -198,13 +266,20 @@
%__7 = bitcast [4 x i8]* @i32v to i32*
store i32 %v3, i32* %__7, align 1
ret void
- ; CHECK: mov eax, dword ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov byte ptr [
- ; CHECK-NEXT: mov ecx, eax
- ; CHECK-NEXT: mov word ptr [
- ; CHECK-NEXT: mov dword ptr [
}
+; CHECK: from_uint64:
+; CHECK: mov eax, dword ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov byte ptr [
+; CHECK-NEXT: mov ecx, eax
+; CHECK-NEXT: mov word ptr [
+; CHECK-NEXT: mov dword ptr [
+;
+; OPTM1: from_uint64:
+; OPTM1: u64v
+; OPTM1: i8v
+; OPTM1: i16v
+; OPTM1: i32v
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/empty-func.ll b/tests_lit/llvm2ice_tests/empty-func.ll
index 98367bc..32d1704 100644
--- a/tests_lit/llvm2ice_tests/empty-func.ll
+++ b/tests_lit/llvm2ice_tests/empty-func.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Trivial test of a trivial function.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/fp.pnacl.ll b/tests_lit/llvm2ice_tests/fp.pnacl.ll
index a9951d9..c31725a 100644
--- a/tests_lit/llvm2ice_tests/fp.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/fp.pnacl.ll
@@ -1,5 +1,11 @@
-; RUIN: %llvm2ice --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This tries to be a comprehensive test of f32 and f64 operations.
+; The CHECK lines are only checking for basic instruction patterns
+; that should be present regardless of the optimization level, so
+; there are no special OPTM1 match lines.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/fpconst.pnacl.ll b/tests_lit/llvm2ice_tests/fpconst.pnacl.ll
index 1e40f76..6ca41e4 100644
--- a/tests_lit/llvm2ice_tests/fpconst.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/fpconst.pnacl.ll
@@ -1,7 +1,3 @@
-; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
-; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
-; RUN: | FileCheck --check-prefix=DUMP %s
-
; This is a smoke test for floating-point constant pooling. It tests
; pooling of various float and double constants (including positive
; and negative NaN) within functions and across functions. Note that
@@ -10,6 +6,11 @@
; number in a reasonable number of digits". See
; http://llvm.org/docs/LangRef.html#simple-constants .
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
+; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
+; RUN: | FileCheck --check-prefix=DUMP %s
+
@__init_array_start = internal constant [0 x i8] zeroinitializer, align 4
@__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4
@__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8
diff --git a/tests_lit/llvm2ice_tests/global.ll b/tests_lit/llvm2ice_tests/global.ll
index 00ed03e..ba5471e 100644
--- a/tests_lit/llvm2ice_tests/global.ll
+++ b/tests_lit/llvm2ice_tests/global.ll
@@ -1,5 +1,8 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Trivial test of the use of internal versus external global
+; functions.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; Note: We don't run this test using a PNaCl bitcode file, because
diff --git a/tests_lit/llvm2ice_tests/icmp-simple.ll b/tests_lit/llvm2ice_tests/icmp-simple.ll
index dc97a9b..f6ca8d5 100644
--- a/tests_lit/llvm2ice_tests/icmp-simple.ll
+++ b/tests_lit/llvm2ice_tests/icmp-simple.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Trivial structural test of 64-bit icmp instructions.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/load.ll b/tests_lit/llvm2ice_tests/load.ll
index 1a1d6a3..6b7b77f 100644
--- a/tests_lit/llvm2ice_tests/load.ll
+++ b/tests_lit/llvm2ice_tests/load.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple test of the load instruction.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -10,7 +12,8 @@
%iv = load i64* %__1, align 1
ret void
-; CHECK: %__1 = i32 %addr_arg
+; CHECK: Initial CFG
+; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: %iv = load i64* {{.*}}, align 1
; CHECK-NEXT: ret void
}
@@ -21,6 +24,7 @@
%iv = load i32* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: %iv = load i32* {{.*}}, align 1
; CHECK-NEXT: ret void
@@ -32,6 +36,7 @@
%iv = load i16* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: %iv = load i16* {{.*}}, align 1
; CHECK-NEXT: ret void
@@ -43,6 +48,7 @@
%iv = load i8* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: %iv = load i8* {{.*}}, align 1
; CHECK-NEXT: ret void
diff --git a/tests_lit/llvm2ice_tests/mangle.ll b/tests_lit/llvm2ice_tests/mangle.ll
new file mode 100644
index 0000000..c76a23d
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/mangle.ll
@@ -0,0 +1,105 @@
+; Tests the Subzero "name mangling" when using the "llvm2ice --prefix"
+; option.
+
+; RUN: %llvm2ice --verbose none %s | FileCheck %s
+; RUN: %llvm2ice --verbose none --prefix Subzero %s | FileCheck --check-prefix=MANGLE %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
+; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
+; RUN: | FileCheck --check-prefix=DUMP %s
+
+define internal void @FuncC(i32 %i) {
+entry:
+ ret void
+}
+; FuncC is a C symbol that isn't recognized as a C++ mangled symbol.
+; CHECK: FuncC:
+; MANGLE: SubzeroFuncC
+
+define internal void @_ZN13TestNamespace4FuncEi(i32 %i) {
+entry:
+ ret void
+}
+; This is Func(int) nested inside namespace TestNamespace.
+; CHECK: _ZN13TestNamespace4FuncEi:
+; MANGLE: _ZN7Subzero13TestNamespace4FuncEi:
+
+define internal void @_ZN13TestNamespace15NestedNamespace4FuncEi(i32 %i) {
+entry:
+ ret void
+}
+; This is Func(int) nested inside two namespaces.
+; CHECK: _ZN13TestNamespace15NestedNamespace4FuncEi:
+; MANGLE: _ZN7Subzero13TestNamespace15NestedNamespace4FuncEi:
+
+define internal void @_Z13FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; This is a non-nested, mangled C++ symbol.
+; CHECK: _Z13FuncCPlusPlusi:
+; MANGLE: _ZN7Subzero13FuncCPlusPlusEi:
+
+define internal void @_ZN12_GLOBAL__N_18FuncAnonEi(i32 %i) {
+entry:
+ ret void
+}
+; This is FuncAnon(int) nested inside an anonymous namespace.
+; CHECK: _ZN12_GLOBAL__N_18FuncAnonEi:
+; MANGLE: _ZN7Subzero12_GLOBAL__N_18FuncAnonEi:
+
+; Now for the illegitimate examples.
+
+; Test for _ZN with no suffix. Don't crash, prepend Subzero.
+define internal void @_ZN(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_ZN:
+
+; Test for _Z<len><str> where <len> is smaller than it should be.
+define internal void @_Z12FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: _ZN7Subzero12FuncCPlusPluEsi:
+
+; Test for _Z<len><str> where <len> is slightly larger than it should be.
+define internal void @_Z14FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: _ZN7Subzero14FuncCPlusPlusiE:
+
+; Test for _Z<len><str> where <len> is much larger than it should be.
+define internal void @_Z114FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_Z114FuncCPlusPlusi:
+
+; Test for _Z<len><str> where we try to overflow the uint32_t holding <len>.
+define internal void @_Z4294967296FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_Z4294967296FuncCPlusPlusi:
+
+; Test for _Z<len><str> where <len> is 0.
+define internal void @_Z0FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: _ZN7Subzero0EFuncCPlusPlusi:
+
+; Test for _Z<len><str> where <len> is -1. LLVM explicitly allows the
+; '-' character in identifiers.
+
+define internal void @_Z-1FuncCPlusPlusi(i32 %i) {
+entry:
+ ret void
+}
+; MANGLE: Subzero_Z-1FuncCPlusPlusi:
+
+; ERRORS-NOT: ICE translation error
+; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/return-int-arg.ll b/tests_lit/llvm2ice_tests/return-int-arg.ll
index 1e2d8b2..67e7715 100644
--- a/tests_lit/llvm2ice_tests/return-int-arg.ll
+++ b/tests_lit/llvm2ice_tests/return-int-arg.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple test of functions returning one of its arguments.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/select-opt.ll b/tests_lit/llvm2ice_tests/select-opt.ll
index 9bb9701..c0358fb 100644
--- a/tests_lit/llvm2ice_tests/select-opt.ll
+++ b/tests_lit/llvm2ice_tests/select-opt.ll
@@ -1,5 +1,11 @@
-; RUIN: %llvm2ice %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple test of the select instruction. The CHECK lines are only
+; checking for basic instruction patterns that should be present
+; regardless of the optimization level, so there are no special OPTM1
+; match lines.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/shift.ll b/tests_lit/llvm2ice_tests/shift.ll
index 674f4db..c1a071f 100644
--- a/tests_lit/llvm2ice_tests/shift.ll
+++ b/tests_lit/llvm2ice_tests/shift.ll
@@ -1,5 +1,9 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This is a test of C-level conversion operations that clang lowers
+; into pairs of shifts.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -17,9 +21,10 @@
%__4 = bitcast [4 x i8]* @i1 to i32*
store i32 %v1, i32* %__4, align 1
ret void
- ; CHECK: shl eax, 24
- ; CHECK-NEXT: sar eax, 24
}
+; CHECK: conv1:
+; CHECK: shl {{.*}}, 24
+; CHECK: sar {{.*}}, 24
define void @conv2() {
entry:
@@ -30,9 +35,10 @@
%__4 = bitcast [4 x i8]* @i2 to i32*
store i32 %v1, i32* %__4, align 1
ret void
- ; CHECK: shl eax, 16
- ; CHECK-NEXT: sar eax, 16
}
+; CHECK: conv2:
+; CHECK: shl {{.*}}, 16
+; CHECK: sar {{.*}}, 16
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/simple-arith.ll b/tests_lit/llvm2ice_tests/simple-arith.ll
deleted file mode 100644
index 8b32a94..0000000
--- a/tests_lit/llvm2ice_tests/simple-arith.ll
+++ /dev/null
@@ -1,35 +0,0 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
-; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
-; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
-; RUN: | FileCheck --check-prefix=DUMP %s
-
-define i64 @add_args_i64(i64 %arg1, i64 %arg2) {
-entry:
- %add = add i64 %arg2, %arg1
- ret i64 %add
-}
-
-; Checks for verbose instruction output
-
-; CHECK: define i64 @add_args
-; CHECK: %add = add i64 %arg2, %arg1
-; CHECK-NEXT: ret i64 %add
-
-define i32 @add_args_i32(i32 %arg1, i32 %arg2) {
-entry:
- %add = add i32 %arg2, %arg1
- ret i32 %add
-}
-
-; Checks for emitted assembly
-
-; CHECK: .globl add_args_i32
-; CHECK: mov eax, dword ptr [esp+4]
-; CHECK-NEXT: mov ecx, dword ptr [esp+8]
-; CHECK-NEXT: add ecx, eax
-; CHECK-NEXT: mov eax, ecx
-; CHECK-NEXT: ret
-
-; ERRORS-NOT: ICE translation error
-; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/simple-cond.ll b/tests_lit/llvm2ice_tests/simple-cond.ll
deleted file mode 100644
index 2161a59..0000000
--- a/tests_lit/llvm2ice_tests/simple-cond.ll
+++ /dev/null
@@ -1,32 +0,0 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
-; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
-; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
-; RUN: | FileCheck --check-prefix=DUMP %s
-
-define internal i32 @simple_cond(i32 %a, i32 %n) {
-entry:
- %cmp = icmp slt i32 %n, 0
-; CHECK: %cmp = icmp slt i32 %n, 0
- br i1 %cmp, label %if.then, label %if.else
-; CHECK-NEXT: br i1 %cmp, label %if.then, label %if.else
-
-if.then:
- %sub = sub i32 1, %n
- br label %if.end
-
-if.else:
- %gep_array = mul i32 %n, 4
- %gep = add i32 %a, %gep_array
- %__6 = inttoptr i32 %gep to i32*
- %v0 = load i32* %__6, align 1
- br label %if.end
-
-if.end:
- %result.0 = phi i32 [ %sub, %if.then ], [ %v0, %if.else ]
-; CHECK: %result.0 = phi i32 [ %sub, %if.then ], [ %v0, %if.else ]
- ret i32 %result.0
-}
-
-; ERRORS-NOT: ICE translation error
-; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/simple-loop.ll b/tests_lit/llvm2ice_tests/simple-loop.ll
index a35e5b3..b983d14c 100644
--- a/tests_lit/llvm2ice_tests/simple-loop.ll
+++ b/tests_lit/llvm2ice_tests/simple-loop.ll
@@ -1,5 +1,9 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This tests a simple loop that sums the elements of an input array.
+; The O2 check patterns represent the best code currently achieved.
+
+; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s
+; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -26,17 +30,7 @@
ret i32 %sum.0.lcssa
}
-; Checks for verbose instruction output
-
-; CHECK: br i1 %cmp4, label %for.body, label %for.end
-; CHECK-NEXT: for.body
-; CHECK: %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
-; CHECK-NEXT: %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
-
-; Checks for emitted assembly
-
; CHECK: .globl simple_loop
-
; CHECK: mov ecx, dword ptr [esp+{{[0-9]+}}]
; CHECK: cmp ecx, 0
; CHECK-NEXT: jg {{.*}}for.body
@@ -49,6 +43,13 @@
; CHECK-NEXT: mov [[ICMPREG:[a-z]+]], [[IREG]]
; CHECK: cmp [[ICMPREG]], ecx
; CHECK-NEXT: jl {{.*}}for.body
+;
+; There's nothing remarkable under Om1 to test for, since Om1 generates
+; such atrocious code (by design).
+; OPTM1: .globl simple_loop
+; OPTM1: cmp {{.*}}, 0
+; OPTM1: jg
+; OPTM1: ret
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ
diff --git a/tests_lit/llvm2ice_tests/store.ll b/tests_lit/llvm2ice_tests/store.ll
index 59e1c2b..789a1de 100644
--- a/tests_lit/llvm2ice_tests/store.ll
+++ b/tests_lit/llvm2ice_tests/store.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice %s -verbose inst | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; Simple test of the store instruction.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -10,6 +12,7 @@
store i64 1, i64* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: store i64 1, {{.*}}, align 1
; CHECK-NEXT: ret void
@@ -21,6 +24,7 @@
store i32 1, i32* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: store i32 1, {{.*}}, align 1
; CHECK-NEXT: ret void
@@ -32,6 +36,7 @@
store i16 1, i16* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: store i16 1, {{.*}}, align 1
; CHECK-NEXT: ret void
@@ -43,6 +48,7 @@
store i8 1, i8* %__1, align 1
ret void
+; CHECK: Initial CFG
; CHECK: %__1 = i32 %addr_arg
; CHECK-NEXT: store i8 1, {{.*}}, align 1
; CHECK-NEXT: ret void
diff --git a/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll b/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
index 3e88b0f..da922d0 100644
--- a/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
@@ -1,14 +1,12 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This test is lowered from C code that does some simple aritmetic
+; with struct members.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
-; This file is lowered from C code that does some simple aritmetic with
-; struct members. It's also built with the PNaCl toolchain so this is the
-; stable ABI subset of LLVM IR (structs are gone, pointers turned into i32,
-; geps gone, etc.)
-
define internal i32 @compute_important_function(i32 %v1, i32 %v2) {
entry:
%__2 = inttoptr i32 %v1 to i32*
diff --git a/tests_lit/llvm2ice_tests/switch-opt.ll b/tests_lit/llvm2ice_tests/switch-opt.ll
index 827dae7..19187e4 100644
--- a/tests_lit/llvm2ice_tests/switch-opt.ll
+++ b/tests_lit/llvm2ice_tests/switch-opt.ll
@@ -1,5 +1,9 @@
-; RUIN: %llvm2ice %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This tests a switch statement, including multiple branches to the
+; same label which also results in phi instructions with multiple
+; entries for the same incoming edge.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
diff --git a/tests_lit/llvm2ice_tests/unreachable.ll b/tests_lit/llvm2ice_tests/unreachable.ll
index 25a3dd6..ab54704 100644
--- a/tests_lit/llvm2ice_tests/unreachable.ll
+++ b/tests_lit/llvm2ice_tests/unreachable.ll
@@ -1,5 +1,7 @@
-; RUIN: %llvm2ice -verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
+; This tests the basic structure of the Unreachable instruction.
+
+; RUN: %llvm2ice --verbose inst %s | FileCheck %s
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
@@ -11,6 +13,7 @@
abort: ; preds = %entry
unreachable
+; CHECK: unreachable
return: ; preds = %entry
%div = sdiv i32 %num, %den