aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll54
-rw-r--r--llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll.expected106
-rw-r--r--llvm/test/tools/UpdateTestChecks/update_test_checks/switch_case.test3
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/type_units_split_dwp_v4.s6
4 files changed, 169 insertions, 0 deletions
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll
new file mode 100644
index 0000000..a804225
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll
@@ -0,0 +1,54 @@
+; RUN: opt < %s -S | FileCheck %s
+
+; Test whether the UTC format the switch-cases correctly, which requires TWO extra spaces.
+
+define i8 @testi8(i8 %x) {
+ switch i8 %x, label %default [
+ i8 0, label %case1
+ i8 1, label %case2
+ i8 2, label %case3
+ i8 3, label %case3
+ ]
+default:
+ ret i8 0
+case1:
+ ret i8 1
+case2:
+ ret i8 2
+case3:
+ ret i8 3
+}
+
+define i32 @testi32(i32 %x) {
+ switch i32 %x, label %default [
+ i32 0, label %case1
+ i32 1, label %case2
+ i32 2, label %case3
+ i32 3, label %case3
+ ]
+default:
+ ret i32 0
+case1:
+ ret i32 1
+case2:
+ ret i32 2
+case3:
+ ret i32 3
+}
+
+define i128 @testi128(i128 %x) {
+ switch i128 %x, label %default [
+ i128 0, label %case1
+ i128 1, label %case2
+ i128 2, label %case3
+ i128 3, label %case3
+ ]
+default:
+ ret i128 0
+case1:
+ ret i128 1
+case2:
+ ret i128 2
+case3:
+ ret i128 3
+}
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll.expected
new file mode 100644
index 0000000..b1977e7
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/switch_case.ll.expected
@@ -0,0 +1,106 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 7
+; RUN: opt < %s -S | FileCheck %s
+
+; Test whether the UTC format the switch-cases correctly, which requires TWO extra spaces.
+
+define i8 @testi8(i8 %x) {
+; CHECK-LABEL: define i8 @testi8(
+; CHECK-SAME: i8 [[X:%.*]]) {
+; CHECK-NEXT: switch i8 [[X]], label %[[DEFAULT:.*]] [
+; CHECK-NEXT: i8 0, label %[[CASE1:.*]]
+; CHECK-NEXT: i8 1, label %[[CASE2:.*]]
+; CHECK-NEXT: i8 2, label %[[CASE3:.*]]
+; CHECK-NEXT: i8 3, label %[[CASE3]]
+; CHECK-NEXT: ]
+; CHECK: [[DEFAULT]]:
+; CHECK-NEXT: ret i8 0
+; CHECK: [[CASE1]]:
+; CHECK-NEXT: ret i8 1
+; CHECK: [[CASE2]]:
+; CHECK-NEXT: ret i8 2
+; CHECK: [[CASE3]]:
+; CHECK-NEXT: ret i8 3
+;
+ switch i8 %x, label %default [
+ i8 0, label %case1
+ i8 1, label %case2
+ i8 2, label %case3
+ i8 3, label %case3
+ ]
+default:
+ ret i8 0
+case1:
+ ret i8 1
+case2:
+ ret i8 2
+case3:
+ ret i8 3
+}
+
+define i32 @testi32(i32 %x) {
+; CHECK-LABEL: define i32 @testi32(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: switch i32 [[X]], label %[[DEFAULT:.*]] [
+; CHECK-NEXT: i32 0, label %[[CASE1:.*]]
+; CHECK-NEXT: i32 1, label %[[CASE2:.*]]
+; CHECK-NEXT: i32 2, label %[[CASE3:.*]]
+; CHECK-NEXT: i32 3, label %[[CASE3]]
+; CHECK-NEXT: ]
+; CHECK: [[DEFAULT]]:
+; CHECK-NEXT: ret i32 0
+; CHECK: [[CASE1]]:
+; CHECK-NEXT: ret i32 1
+; CHECK: [[CASE2]]:
+; CHECK-NEXT: ret i32 2
+; CHECK: [[CASE3]]:
+; CHECK-NEXT: ret i32 3
+;
+ switch i32 %x, label %default [
+ i32 0, label %case1
+ i32 1, label %case2
+ i32 2, label %case3
+ i32 3, label %case3
+ ]
+default:
+ ret i32 0
+case1:
+ ret i32 1
+case2:
+ ret i32 2
+case3:
+ ret i32 3
+}
+
+define i128 @testi128(i128 %x) {
+; CHECK-LABEL: define i128 @testi128(
+; CHECK-SAME: i128 [[X:%.*]]) {
+; CHECK-NEXT: switch i128 [[X]], label %[[DEFAULT:.*]] [
+; CHECK-NEXT: i128 0, label %[[CASE1:.*]]
+; CHECK-NEXT: i128 1, label %[[CASE2:.*]]
+; CHECK-NEXT: i128 2, label %[[CASE3:.*]]
+; CHECK-NEXT: i128 3, label %[[CASE3]]
+; CHECK-NEXT: ]
+; CHECK: [[DEFAULT]]:
+; CHECK-NEXT: ret i128 0
+; CHECK: [[CASE1]]:
+; CHECK-NEXT: ret i128 1
+; CHECK: [[CASE2]]:
+; CHECK-NEXT: ret i128 2
+; CHECK: [[CASE3]]:
+; CHECK-NEXT: ret i128 3
+;
+ switch i128 %x, label %default [
+ i128 0, label %case1
+ i128 1, label %case2
+ i128 2, label %case3
+ i128 3, label %case3
+ ]
+default:
+ ret i128 0
+case1:
+ ret i128 1
+case2:
+ ret i128 2
+case3:
+ ret i128 3
+}
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/switch_case.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/switch_case.test
new file mode 100644
index 0000000..891dbe0
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/switch_case.test
@@ -0,0 +1,3 @@
+## switch_case test checking that update_test_checks.py works correctly
+# RUN: cp -f %S/Inputs/switch_case.ll %t.ll && %update_test_checks %t.ll --version 7
+# RUN: diff -u %t.ll %S/Inputs/switch_case.ll.expected
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/type_units_split_dwp_v4.s b/llvm/test/tools/llvm-dwarfdump/X86/type_units_split_dwp_v4.s
index becd9d1..519edf04 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/type_units_split_dwp_v4.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/type_units_split_dwp_v4.s
@@ -1,6 +1,12 @@
## This test uses TU index for type parsing in dwp and makes sure the DWARF4 type is
## successfully retrieved.
+## cd to a unique dir so we can refer to the file as just "test.dwo" in the
+## assembly test input below.
+# RUN: rm -rf %t
+# RUN: mkdir %t
+# RUN: cd %t
+
# RUN: llvm-mc %s --split-dwarf-file=test.dwo -filetype obj -triple x86_64 -o test.o
# RUN: llvm-dwp -e test.o -o test.dwp
# RUN: llvm-dwarfdump test.dwp | FileCheck %s