[llvm] 809ee6c - [X86][test] Update tagged-globals*.ll tests
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 12:55:06 PST 2023
Author: Arthur Eubanks
Date: 2023-12-15T12:54:55-08:00
New Revision: 809ee6cfcf48c3a3681e3dbde425e65b35fa7010
URL: https://github.com/llvm/llvm-project/commit/809ee6cfcf48c3a3681e3dbde425e65b35fa7010
DIFF: https://github.com/llvm/llvm-project/commit/809ee6cfcf48c3a3681e3dbde425e65b35fa7010.diff
LOG: [X86][test] Update tagged-globals*.ll tests
Use update_llc_test_checks.py.
Split out jump table tests into separate file since we don't want to check the exact instruction sequence for it.
Added:
llvm/test/CodeGen/X86/tagged-globals-jump-table.ll
Modified:
llvm/test/CodeGen/X86/tagged-globals-pic.ll
llvm/test/CodeGen/X86/tagged-globals-static.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/tagged-globals-jump-table.ll b/llvm/test/CodeGen/X86/tagged-globals-jump-table.ll
new file mode 100644
index 00000000000000..a436df0c3f5552
--- /dev/null
+++ b/llvm/test/CodeGen/X86/tagged-globals-jump-table.ll
@@ -0,0 +1,29 @@
+; RUN: llc --relocation-model=pic < %s | FileCheck %s
+; RUN: llc --relocation-model=static < %s | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Jump tables shouldn't go through the GOT.
+define i32 @jump_table(i32 %x) #0 {
+; CHECK-LABEL: jump_table:
+; CHECK-NOT: @GOT
+ switch i32 %x, label %default [
+ i32 0, label %1
+ i32 1, label %2
+ i32 2, label %3
+ i32 3, label %4
+ ]
+1:
+ ret i32 7
+2:
+ ret i32 42
+3:
+ ret i32 3
+4:
+ ret i32 8
+default:
+ ret i32 %x
+}
+
+attributes #0 = { "target-features"="+tagged-globals" }
diff --git a/llvm/test/CodeGen/X86/tagged-globals-pic.ll b/llvm/test/CodeGen/X86/tagged-globals-pic.ll
index 89b424340ef983..4f85b5ed99695d 100644
--- a/llvm/test/CodeGen/X86/tagged-globals-pic.ll
+++ b/llvm/test/CodeGen/X86/tagged-globals-pic.ll
@@ -1,5 +1,5 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc --relocation-model=pic < %s | FileCheck %s
-; RUN: llc --relocation-model=pic --relax-elf-relocations --filetype=obj -o - < %s | llvm-objdump -d -r - | FileCheck %s --check-prefix=OBJ
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -8,78 +8,39 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @func()
define ptr @global_addr() #0 {
- ; CHECK-LABEL: global_addr:
- ; CHECK: movq global at GOTPCREL_NORELAX(%rip), %rax
- ; CHECK: retq
-
- ; OBJ-LABEL: <global_addr>:
- ; OBJ: movq (%rip),
- ; OBJ-NEXT: R_X86_64_GOTPCREL global
-
+; CHECK-LABEL: global_addr:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq global at GOTPCREL_NORELAX(%rip), %rax
+; CHECK-NEXT: retq
ret ptr @global
}
define i32 @global_load() #0 {
- ; CHECK-LABEL: global_load:
- ; CHECK: movq global at GOTPCREL_NORELAX(%rip), [[REG:%r[0-9a-z]+]]
- ; CHECK: movl ([[REG]]), %eax
- ; CHECK: retq
-
- ; OBJ-LABEL: <global_load>:
- ; OBJ: movq (%rip),
- ; OBJ-NEXT: R_X86_64_GOTPCREL global
-
+; CHECK-LABEL: global_load:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq global at GOTPCREL_NORELAX(%rip), %rax
+; CHECK-NEXT: movl (%rax), %eax
+; CHECK-NEXT: retq
%load = load i32, ptr @global
ret i32 %load
}
define void @global_store() #0 {
- ; CHECK-LABEL: global_store:
- ; CHECK: movq global at GOTPCREL_NORELAX(%rip), [[REG:%r[0-9a-z]+]]
- ; CHECK: movl $0, ([[REG]])
- ; CHECK: retq
-
- ; OBJ-LABEL: <global_store>:
- ; OBJ: movq (%rip),
- ; OBJ-NEXT: R_X86_64_GOTPCREL global
-
+; CHECK-LABEL: global_store:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq global at GOTPCREL_NORELAX(%rip), %rax
+; CHECK-NEXT: movl $0, (%rax)
+; CHECK-NEXT: retq
store i32 0, ptr @global
ret void
}
define ptr @func_addr() #0 {
- ; CHECK-LABEL: func_addr:
- ; CHECK: movq func at GOTPCREL(%rip), %rax
- ; CHECK: retq
-
- ; OBJ-LABEL: <func_addr>:
- ; OBJ: movq (%rip),
- ; OBJ-NEXT: R_X86_64_REX_GOTPCRELX func
-
+; CHECK-LABEL: func_addr:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq func at GOTPCREL(%rip), %rax
+; CHECK-NEXT: retq
ret ptr @func
}
-; Jump tables shouldn't go through the GOT.
-define i32 @jump_table(i32 %x) #0 {
- ; CHECK-LABEL: jump_table:
- ; CHECK-NOT: @GOT
-
- switch i32 %x, label %default [
- i32 0, label %1
- i32 1, label %2
- i32 2, label %3
- i32 3, label %4
- ]
-1:
- ret i32 7
-2:
- ret i32 42
-3:
- ret i32 3
-4:
- ret i32 8
-default:
- ret i32 %x
-}
-
attributes #0 = { "target-features"="+tagged-globals" }
diff --git a/llvm/test/CodeGen/X86/tagged-globals-static.ll b/llvm/test/CodeGen/X86/tagged-globals-static.ll
index 35fb6a23ee9005..bddbaa5592da58 100644
--- a/llvm/test/CodeGen/X86/tagged-globals-static.ll
+++ b/llvm/test/CodeGen/X86/tagged-globals-static.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc --relocation-model=static < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@@ -7,62 +8,39 @@ target triple = "x86_64-unknown-linux-gnu"
declare dso_local void @func()
define ptr @global_addr() #0 {
- ; CHECK-LABEL: global_addr:
- ; CHECK: movq global at GOTPCREL_NORELAX(%rip), %rax
- ; CHECK: retq
-
+; CHECK-LABEL: global_addr:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq global at GOTPCREL_NORELAX(%rip), %rax
+; CHECK-NEXT: retq
ret ptr @global
}
define i32 @global_load() #0 {
- ; CHECK-LABEL: global_load:
- ; CHECK: movq global at GOTPCREL_NORELAX(%rip), [[REG:%r[0-9a-z]+]]
- ; CHECK: movl ([[REG]]), %eax
- ; CHECK: retq
-
+; CHECK-LABEL: global_load:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq global at GOTPCREL_NORELAX(%rip), %rax
+; CHECK-NEXT: movl (%rax), %eax
+; CHECK-NEXT: retq
%load = load i32, ptr @global
ret i32 %load
}
define void @global_store() #0 {
- ; CHECK-LABEL: global_store:
- ; CHECK: movq global at GOTPCREL_NORELAX(%rip), [[REG:%r[0-9a-z]+]]
- ; CHECK: movl $0, ([[REG]])
- ; CHECK: retq
-
+; CHECK-LABEL: global_store:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq global at GOTPCREL_NORELAX(%rip), %rax
+; CHECK-NEXT: movl $0, (%rax)
+; CHECK-NEXT: retq
store i32 0, ptr @global
ret void
}
define ptr @func_addr() #0 {
- ; CHECK-LABEL: func_addr:
- ; CHECK: movl $func, %eax
- ; CHECK: retq
-
+; CHECK-LABEL: func_addr:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movl $func, %eax
+; CHECK-NEXT: retq
ret ptr @func
}
-; Jump tables shouldn't go through the GOT.
-define i32 @jump_table(i32 %x) #0 {
- ; CHECK-LABEL: jump_table:
- ; CHECK-NOT: @GOT
-
- switch i32 %x, label %default [
- i32 0, label %1
- i32 1, label %2
- i32 2, label %3
- i32 3, label %4
- ]
-1:
- ret i32 7
-2:
- ret i32 42
-3:
- ret i32 3
-4:
- ret i32 8
-default:
- ret i32 %x
-}
-
attributes #0 = { "target-features"="+tagged-globals" }
More information about the llvm-commits
mailing list