[llvm] r279665 - ARM: don't diagnose cbz/cbnz to Thumb functions.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 14:21:29 PDT 2016
Author: tnorthover
Date: Wed Aug 24 16:21:29 2016
New Revision: 279665
URL: http://llvm.org/viewvc/llvm-project?rev=279665&view=rev
Log:
ARM: don't diagnose cbz/cbnz to Thumb functions.
A branch-distance to a Thumb function shouldn't be forced to be odd for
CBZ/CBNZ instructions because (assuming it's within range), it's going to be a
valid, even offset.
Added:
llvm/trunk/test/MC/ARM/thumb-cb-offsets.s
- copied, changed from r279633, llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s
llvm/trunk/test/MC/ARM/thumb-cb-thumbfunc.s
Removed:
llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=279665&r1=279664&r2=279665&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Wed Aug 24 16:21:29 2016
@@ -710,7 +710,8 @@ void ARMAsmBackend::processFixupValue(co
(unsigned)Fixup.getKind() != ARM::fixup_arm_adr_pcrel_12 &&
(unsigned)Fixup.getKind() != ARM::fixup_thumb_adr_pcrel_10 &&
(unsigned)Fixup.getKind() != ARM::fixup_t2_adr_pcrel_12 &&
- (unsigned)Fixup.getKind() != ARM::fixup_arm_thumb_cp) {
+ (unsigned)Fixup.getKind() != ARM::fixup_arm_thumb_cp &&
+ (unsigned)Fixup.getKind() != ARM::fixup_arm_thumb_cb) {
if (Sym) {
if (Asm.isThumbFunc(Sym))
Value |= 1;
Removed: llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s?rev=279664&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s (original)
+++ llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s (removed)
@@ -1,31 +0,0 @@
-@ RUN: not llvm-mc -triple thumbv7m-none-eabi -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s
-@ RUN: not llvm-mc -triple thumbv8m.base-none-eabi -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s
-
-label0:
- .word 4
-
-@ CHECK: out of range pc-relative fixup value
- cbz r0, label0
-@ CHECK: out of range pc-relative fixup value
- cbnz r0, label0
-
-@ CHECK: out of range pc-relative fixup value
- cbz r0, label1
-@ CHECK: out of range pc-relative fixup value
- cbnz r0, label1
-
- .space 1000
-label1:
- nop
-
-@ CHECK: out of range pc-relative fixup value
- cbz r0, label2
- .space 130
-label2:
- nop
-
-@ CHECK-NOT: label3
- cbnz r0, label3
- .space 128
-label3:
- nop
Copied: llvm/trunk/test/MC/ARM/thumb-cb-offsets.s (from r279633, llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb-cb-offsets.s?p2=llvm/trunk/test/MC/ARM/thumb-cb-offsets.s&p1=llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s&r1=279633&r2=279665&rev=279665&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb-cb-negative-offsets.s (original)
+++ llvm/trunk/test/MC/ARM/thumb-cb-offsets.s Wed Aug 24 16:21:29 2016
@@ -24,6 +24,13 @@ label1:
label2:
nop
+@ CHECK: out of range pc-relative fixup value
+ cbz r0, label4
+ .space 33
+label4:
+ nop
+
+ .align 2
@ CHECK-NOT: label3
cbnz r0, label3
.space 128
Added: llvm/trunk/test/MC/ARM/thumb-cb-thumbfunc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb-cb-thumbfunc.s?rev=279665&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb-cb-thumbfunc.s (added)
+++ llvm/trunk/test/MC/ARM/thumb-cb-thumbfunc.s Wed Aug 24 16:21:29 2016
@@ -0,0 +1,8 @@
+@ RUN: llvm-mc -triple thumbv7-apple-macho -filetype=obj -o %t %s
+@ RUN: llvm-objdump -d -triple thumbv7 %t | FileCheck %s
+
+@ CHECK: cbnz r0, #0
+ .thumb_func label4
+ cbnz r0, label4
+ .space 2
+label4:
More information about the llvm-commits
mailing list