summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2019-07-12 04:58:45 +0000
committerSimon Atanasyan <simon@atanasyan.com>2019-07-12 04:58:45 +0000
commitee5af50eb0c3b40bed784ba3f8bde1b06c0f6804 (patch)
tree6f707085bd0b8dd64effb0e83a6155fe06774886 /llvm/test/CodeGen
parent27ed1c5bb80c8da317cd80bdd50cb22189d1c6fb (diff)
downloadbcm5719-llvm-ee5af50eb0c3b40bed784ba3f8bde1b06c0f6804.tar.gz
bcm5719-llvm-ee5af50eb0c3b40bed784ba3f8bde1b06c0f6804.zip
[mips] Fix JmpLink to texternalsym and tglobaladdr on mcroMIPS R6
There is not match for the `MipsJmpLink texternalsym` and `MipsJmpLink tglobaladdr` patterns for microMIPS R6. As a result LLVM incorrectly selects the `JALRC16` compact 2-byte instruction which takes a target instruction address from a register only and assign `R_MIPS_32` relocation for this instruction. This relocation completely overwrites `JALRC16` and nearby instructions. This patch adds missed matching patterns, selects `BALC` instruction and assign a correct `R_MICROMIPS_PC26_S1` relocation. Differential Revision: https://reviews.llvm.org/D64552 llvm-svn: 365870
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/Mips/llvm-ir/fptosi.ll4
-rw-r--r--llvm/test/CodeGen/Mips/micromips-delay-slot.ll2
-rw-r--r--llvm/test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll16
-rw-r--r--llvm/test/CodeGen/Mips/tailcall/tailcall.ll18
4 files changed, 25 insertions, 15 deletions
diff --git a/llvm/test/CodeGen/Mips/llvm-ir/fptosi.ll b/llvm/test/CodeGen/Mips/llvm-ir/fptosi.ll
index 6b4fd603056..3bf17abc796 100644
--- a/llvm/test/CodeGen/Mips/llvm-ir/fptosi.ll
+++ b/llvm/test/CodeGen/Mips/llvm-ir/fptosi.ll
@@ -208,7 +208,7 @@ define i32 @test1(float %t) {
; MMR6-SF-NEXT: # <MCOperand Reg:{{[0-9]+}}>
; MMR6-SF-NEXT: # <MCOperand Imm:20>>
; MMR6-SF-NEXT: .cfi_offset 31, -4
-; MMR6-SF-NEXT: jalr __fixsfsi # <MCInst #{{[0-9]+}} JALRC16_MMR6
+; MMR6-SF-NEXT: balc __fixsfsi # <MCInst #{{[0-9]+}} BALC_MMR6
; MMR6-SF-NEXT: # <MCOperand Expr:(__fixsfsi)>>
; MMR6-SF-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; MMR6-SF-NEXT: # <MCInst #{{[0-9]+}} LW
@@ -399,7 +399,7 @@ define i32 @test2(double %t) {
; MMR6-SF-NEXT: # <MCOperand Reg:{{[0-9]+}}>
; MMR6-SF-NEXT: # <MCOperand Imm:20>>
; MMR6-SF-NEXT: .cfi_offset 31, -4
-; MMR6-SF-NEXT: jalr __fixdfsi # <MCInst #{{[0-9]+}} JALRC16_MMR6
+; MMR6-SF-NEXT: balc __fixdfsi # <MCInst #{{[0-9]+}} BALC_MMR6
; MMR6-SF-NEXT: # <MCOperand Expr:(__fixdfsi)>>
; MMR6-SF-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; MMR6-SF-NEXT: # <MCInst #{{[0-9]+}} LW
diff --git a/llvm/test/CodeGen/Mips/micromips-delay-slot.ll b/llvm/test/CodeGen/Mips/micromips-delay-slot.ll
index 5c6aa36a413..f80446c8299 100644
--- a/llvm/test/CodeGen/Mips/micromips-delay-slot.ll
+++ b/llvm/test/CodeGen/Mips/micromips-delay-slot.ll
@@ -18,5 +18,5 @@ declare i32 @bar(i32 signext) #1
; CHECK: jals
; CHECK-NEXT: sll16
-; CHECK-MMR6: jal
+; CHECK-MMR6: balc
; CHECK-MMR6-NOT: sll16
diff --git a/llvm/test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll b/llvm/test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll
index 54302fb662e..7ea689ef99f 100644
--- a/llvm/test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll
+++ b/llvm/test/CodeGen/Mips/micromips-target-external-symbol-reloc.ll
@@ -1,13 +1,23 @@
-; RUN: llc -mtriple=mips-mti-linux-gnu -mcpu=mips32r2 -mattr=+micromips -stop-after=finalize-isel < %s | FileCheck %s
+; RUN: llc -mtriple=mips-mti-linux-gnu -mcpu=mips32r2 -mattr=+micromips \
+; RUN: -stop-after=finalize-isel < %s | FileCheck --check-prefix=MM2 %s
+; RUN: llc -mtriple=mips-mti-linux-gnu -mcpu=mips32r6 -mattr=+micromips \
+; RUN: -stop-after=finalize-isel < %s | FileCheck --check-prefix=MM6 %s
-; CHECK: JAL_MM
-; CHECK-NOT: JALR16_MM
+; MM2: JAL_MM @bar
+; MM2: JAL_MM &memset
+; MM2-NOT: JALR16_MM
+
+; MM6: JAL_MMR6 @bar
+; MM6: JAL_MMR6 &memset
+; MM6-NOT: JALRC16_MMR6
define dso_local void @foo(i32* nocapture %ar) local_unnamed_addr {
entry:
+ call void @bar()
%0 = bitcast i32* %ar to i8*
tail call void @llvm.memset.p0i8.i32(i8* align 4 %0, i8 0, i32 100, i1 false)
ret void
}
declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1)
+declare void @bar()
diff --git a/llvm/test/CodeGen/Mips/tailcall/tailcall.ll b/llvm/test/CodeGen/Mips/tailcall/tailcall.ll
index 8822323c521..50759b2104e 100644
--- a/llvm/test/CodeGen/Mips/tailcall/tailcall.ll
+++ b/llvm/test/CodeGen/Mips/tailcall/tailcall.ll
@@ -47,7 +47,7 @@ entry:
; PIC32MM: jalr $25
; PIC32R6: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; N64: jalr $25
; N64R6: jalr $25
; PIC16: jalrc
@@ -65,7 +65,7 @@ entry:
; PIC32MM: jalr $25
; PIC32R6: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; N64: jalr $25
; N64R6: jalr $25
; PIC16: jalrc
@@ -83,7 +83,7 @@ entry:
; PIC32R6: jalr $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; N64: jalr $25
; N64R6: jalr $25
; PIC16: jalrc
@@ -179,7 +179,7 @@ entry:
; PIC32R6: jalr $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; PIC64: jalr $25
; STATIC64: jal
; PIC16: jalrc
@@ -217,7 +217,7 @@ entry:
; PIC32R6: jalrc $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; STATIC64: jal
; PIC64: jalr $25
; PIC64R6: jalrc $25
@@ -236,7 +236,7 @@ entry:
; PIC32R6: jalr $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; STATIC64: jal
; PIC64: jalr $25
; PIC64R6: jalr $25
@@ -255,7 +255,7 @@ entry:
; PIC32R6: jalrc $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; STATIC64: jal
; PIC64: jalr $25
; PIC64R6: jalrc $25
@@ -276,7 +276,7 @@ entry:
; PIC32R6: jalrc $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; STATIC64: jal
; PIC64: jalr $25
; PIC64R6: jalrc $25
@@ -297,7 +297,7 @@ entry:
; PIC32R6: jalr $25
; PIC32MM: jalr $25
; STATIC32: jal
-; STATIC32MMR6: jal
+; STATIC32MMR6: balc
; STATIC64: jal
; PIC64R6: jalr $25
; PIC64: jalr $25
OpenPOWER on IntegriCloud