[llvm] 3bf6cbd - [JITLink][AArch32] Add tests for BLX interworking calls
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 23 13:02:28 PST 2023
Author: Stefan Gränitz
Date: 2023-11-23T22:01:41+01:00
New Revision: 3bf6cbd51a38c17516d832e5d409cbd4faa1d238
URL: https://github.com/llvm/llvm-project/commit/3bf6cbd51a38c17516d832e5d409cbd4faa1d238
DIFF: https://github.com/llvm/llvm-project/commit/3bf6cbd51a38c17516d832e5d409cbd4faa1d238.diff
LOG: [JITLink][AArch32] Add tests for BLX interworking calls
Exercise transformation of BL into BLX instructions, if
instruction set mode differs between origin and target.
Added:
Modified:
llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_arm_reloc.s
llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
Removed:
################################################################################
diff --git a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_arm_reloc.s b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_arm_reloc.s
index cc65193af736f3b..6fd383e2cce5c9f 100644
--- a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_arm_reloc.s
+++ b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_arm_reloc.s
@@ -8,33 +8,46 @@
.text
.syntax unified
-# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_CALL call_target
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_CALL call_target_arm
# CHECK-INSTR: 00000000 <call_site>:
-# CHECK-INSTR: 0: ebfffffe bl 0x0 <call_site>
-# CHECK-INSTR: 00000004 <call_target>:
-# CHECK-INSTR: 4: e12fff1e bx lr
+# CHECK-INSTR: 0: ebfffffe bl
+# CHECK-INSTR: 4: ebfffffe bl
+# CHECK-INSTR: 0000000c <call_target_arm>
+# CHECK-INSTR: 00000010 <call_target_thumb>
# ARM branch offset is 8, because it accounts for an additional prefetch
# instruction that increments PC even though it is implicit
-# jitlink-check: decode_operand(call_site, 0) = call_target - (call_site + 8)
+# jitlink-check: decode_operand(call_site + 0, 0) = call_target_arm - (call_site + 8)
+# jitlink-check: decode_operand(call_site + 4, 0) = call_target_thumb - (call_site + 12)
.globl call_site
.type call_site,%function
.p2align 2
call_site:
- bl call_target
- .size call_site, .-call_site
+ bl call_target_arm
+ bl call_target_thumb
+ bx lr
+ .size call_site, .-call_site
- .globl call_target
- .type call_target,%function
+ .globl call_target_arm
+ .type call_target_arm,%function
.p2align 2
-call_target:
+call_target_arm:
+ bx lr
+ .size call_target_arm, .-call_target_arm
+
+ .code 16
+ .globl call_target_thumb
+ .type call_target_thumb,%function
+ .p2align 1
+ .thumb_func
+call_target_thumb:
bx lr
- .size call_target, .-call_target
+ .size call_target_thumb, .-call_target_thumb
+ .code 32
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_JUMP24 jump24_target
-# CHECK-INSTR: 00000008 <jump24_site>:
-# CHECK-INSTR: 8: eafffffe b 0x8 <jump24_site>
-# CHECK-INSTR: 0000000c <jump24_target>:
-# CHECK-INSTR: c: e12fff1e bx lr
+# CHECK-INSTR: 00000014 <jump24_site>:
+# CHECK-INSTR: 14: eafffffe b
+# CHECK-INSTR: 00000018 <jump24_target>
# jitlink-check: decode_operand(jump24_site, 0) = jump24_target - (jump24_site + 8)
.globl jump24_site
.type jump24_site,%function
@@ -52,8 +65,8 @@ jump24_target:
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_MOVW_ABS_NC data_symbol
-# CHECK-INSTR: 00000010 <movw>:
-# CHECK-INSTR: 10: e3000000 movw r0, #0x0
+# CHECK-INSTR: 0000001c <movw>:
+# CHECK-INSTR: 1c: e3000000 movw r0, #0x0
# jitlink-check: decode_operand(movw, 1) = (data_symbol&0x0000ffff)
.globl movw
.type movw,%function
@@ -63,8 +76,8 @@ movw:
.size movw, .-movw
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_MOVT_ABS data_symbol
-# CHECK-INSTR: 00000014 <movt>:
-# CHECK-INSTR: 14: e3400000 movt r0, #0x0
+# CHECK-INSTR: 00000020 <movt>:
+# CHECK-INSTR: 20: e3400000 movt r0, #0x0
# We decode the operand with index 2, because movt generates one leading implicit
# predicate operand that we have to skip in order to decode the data_symbol operand
# jitlink-check: decode_operand(movt, 2) = (data_symbol&0xffff0000>>16)
diff --git a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
index c4f4d4a9e10a114..86f011834baae9f 100644
--- a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
+++ b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
@@ -9,37 +9,47 @@
.text
.syntax unified
-# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_CALL call_target
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_CALL call_target_thumb
# CHECK-INSTR: 00000000 <call_site>:
-# CHECK-INSTR: 0: f7ff fffe bl 0x0 <call_site>
-# CHECK-INSTR: 00000004 <call_target>:
-# CHECK-INSTR: 4: 4770 bx lr
+# CHECK-INSTR: 0: f7ff fffe bl
+# CHECK-INSTR: 4: f7ff fffe bl
+# CHECK-INSTR: 00000008 <call_target_thumb>
+# CHECK-INSTR: 0000000c <call_target_arm>
# We decode the operand with index 2, because bl generates two leading implicit
# predicate operands that we have to skip in order to decode the call_target operand
-# jitlink-check: decode_operand(call_site, 2) = call_target - next_pc(call_site)
+# jitlink-check: decode_operand(call_site + 0, 2) = call_target_thumb - (call_site + 4)
+# jitlink-check: decode_operand(call_site + 4, 2) = call_target_arm - (call_site + 8)
.globl call_site
.type call_site,%function
.p2align 1
.code 16
.thumb_func
call_site:
- bl call_target
- .size call_site, .-call_site
+ bl call_target_thumb
+ bl call_target_arm
+ .size call_site, .-call_site
- .globl call_target
- .type call_target,%function
+ .globl call_target_thumb
+ .type call_target_thumb,%function
.p2align 1
.code 16
.thumb_func
-call_target:
+call_target_thumb:
bx lr
- .size call_target, .-call_target
+ .size call_target_thumb, .-call_target_thumb
+
+ .globl call_target_arm
+ .type call_target_arm,%function
+ .p2align 2
+ .code 32
+call_target_arm:
+ bx lr
+ .size call_target_arm, .-call_target_arm
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_JUMP24 jump24_target
-# CHECK-INSTR: 00000006 <jump24_site>:
-# CHECK-INSTR: 6: f7ff bffe b.w 0x6 <jump24_site>
-# CHECK-INSTR: 0000000a <jump24_target>:
-# CHECK-INSTR: a: 4770 bx lr
+# CHECK-INSTR: 00000010 <jump24_site>:
+# CHECK-INSTR: 10: f7ff bffe b.w
+# CHECK-INSTR: 00000014 <jump24_target>
# b.w generates two implicit predicate operands as well, but they are trailing
# operands, so there is no need to adjust the operand index.
# jitlink-check: decode_operand(jump24_site, 0) = jump24_target - next_pc(jump24_site)
@@ -62,8 +72,8 @@ jump24_target:
.size jump24_target, .-jump24_target
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_MOVW_ABS_NC data_symbol
-# CHECK-INSTR: 0000000c <movw>:
-# CHECK-INSTR: c: f240 0000 movw r0, #0x0
+# CHECK-INSTR: 00000016 <movw>:
+# CHECK-INSTR: 16: f240 0000 movw r0, #0x0
# jitlink-check: decode_operand(movw, 1) = (data_symbol&0x0000ffff)
.globl movw
.type movw,%function
@@ -75,8 +85,8 @@ movw:
.size movw, .-movw
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_MOVT_ABS data_symbol
-# CHECK-INSTR: 00000010 <movt>:
-# CHECK-INSTR: 10: f2c0 0000 movt r0, #0x0
+# CHECK-INSTR: 0000001a <movt>:
+# CHECK-INSTR: 1a: f2c0 0000 movt r0, #0x0
# We decode the operand with index 2, because movt generates one leading implicit
# predicate operand that we have to skip in order to decode the data_symbol operand
# jitlink-check: decode_operand(movt, 2) = (data_symbol&0xffff0000>>16)
@@ -97,8 +107,8 @@ data_symbol:
.text
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_MOVW_PREL_NC external_func
-# CHECK-INSTR: 00000014 <movw_prel>:
-# CHECK-INSTR: 14: f240 0000 movw r0, #0x0
+# CHECK-INSTR: 0000001e <movw_prel>:
+# CHECK-INSTR: 1e: f240 0000 movw r0, #0x0
# jitlink-check: decode_operand(movw_prel, 1) = \
# jitlink-check: ((external_func - movw_prel)&0x0000ffff)
.globl movw_prel
@@ -111,8 +121,8 @@ movw_prel:
.size movw_prel, .-movw_prel
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_MOVT_PREL external_func
-# CHECK-INSTR: 00000018 <movt_prel>:
-# CHECK-INSTR: 18: f2c0 0000 movt r0, #0x0
+# CHECK-INSTR: 00000022 <movt_prel>:
+# CHECK-INSTR: 22: f2c0 0000 movt r0, #0x0
# jitlink-check: decode_operand(movt_prel, 2) = \
# jitlink-check: ((external_func - movt_prel)&0xffff0000>>16)
.globl movt_prel
More information about the llvm-commits
mailing list