Add support for vector types.
- Add vector types to the type table.
- Add support for parsing vector types in llvm2ice.
- Legalize undef vector values to zero. Test that undef vector values are lowered correctly.
BUG=none
R=jvoung@chromium.org, stichnot@chromium.org
Review URL: https://codereview.chromium.org/353553004
diff --git a/tests_lit/llvm2ice_tests/undef.ll b/tests_lit/llvm2ice_tests/undef.ll
index 2df08ea..db69f05 100644
--- a/tests_lit/llvm2ice_tests/undef.ll
+++ b/tests_lit/llvm2ice_tests/undef.ll
@@ -7,31 +7,87 @@
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
; RUN: | FileCheck --check-prefix=DUMP %s
-define i32 @undefi32() {
+define i32 @undef_i32() {
entry:
-; CHECK-LABEL: undefi32:
ret i32 undef
+; CHECK-LABEL: undef_i32:
; CHECK: mov eax, 0
; CHECK: ret
}
-define i64 @undefi64() {
+define i64 @undef_i64() {
entry:
-; CHECK-LABEL: undefi64:
ret i64 undef
+; CHECK-LABEL: undef_i64:
; CHECK-DAG: mov eax, 0
; CHECK-DAG: mov edx, 0
; CHECK: ret
}
-define float @undeffloat() {
+define float @undef_float() {
entry:
-; CHECK-LABEL: undeffloat:
ret float undef
+; CHECK-LABEL: undef_float:
; CHECK-NOT: sub esp
; CHECK: fld
; CHECK: ret
}
+define <4 x i1> @undef_v4i1() {
+entry:
+ ret <4 x i1> undef
+; CHECK-LABEL: undef_v4i1:
+; CHECK: pxor
+; CHECK: ret
+}
+
+define <8 x i1> @undef_v8i1() {
+entry:
+ ret <8 x i1> undef
+; CHECK-LABEL: undef_v8i1:
+; CHECK: pxor
+; CHECK: ret
+}
+
+define <16 x i1> @undef_v16i1() {
+entry:
+ ret <16 x i1> undef
+; CHECK-LABEL: undef_v16i1:
+; CHECK: pxor
+; CHECK: ret
+}
+
+define <16 x i8> @undef_v16i8() {
+entry:
+ ret <16 x i8> undef
+; CHECK-LABEL: undef_v16i8:
+; CHECK: pxor
+; CHECK: ret
+}
+
+define <8 x i16> @undef_v8i16() {
+entry:
+ ret <8 x i16> undef
+; CHECK-LABEL: undef_v8i16:
+; CHECK: pxor
+; CHECK: ret
+}
+
+define <4 x i32> @undef_v4i32() {
+entry:
+ ret <4 x i32> undef
+; CHECK-LABEL: undef_v4i32:
+; CHECK: pxor
+; CHECK: ret
+}
+
+define <4 x float> @undef_v4f32() {
+entry:
+ ret <4 x float> undef
+; CHECK-LABEL: undef_v4f32:
+; CHECK: pxor
+; CHECK: ret
+}
+
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ