From dc1ed5785862deadfe9e7b3e3dc7054bc138c53b Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Sun, 14 Apr 2013 01:53:23 +0000 Subject: [PATCH] Fix patterns for 64-bit pointers. This fixes the pic32 code model for SPARC v9. llvm-svn: 179469 --- llvm/lib/Target/Sparc/SparcInstrInfo.td | 6 ++---- llvm/test/CodeGen/SPARC/globals.ll | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.td b/llvm/lib/Target/Sparc/SparcInstrInfo.td index 5ff439583c5c..07e07f1db303 100644 --- a/llvm/lib/Target/Sparc/SparcInstrInfo.td +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td @@ -796,10 +796,8 @@ def : Pat<(SPhi tconstpool:$in), (SETHIi tconstpool:$in)>; def : Pat<(SPlo tconstpool:$in), (ORri (i32 G0), tconstpool:$in)>; // Add reg, lo. This is used when taking the addr of a global/constpool entry. -def : Pat<(add i32:$r, (SPlo tglobaladdr:$in)), - (ADDri $r, tglobaladdr:$in)>; -def : Pat<(add i32:$r, (SPlo tconstpool:$in)), - (ADDri $r, tconstpool:$in)>; +def : Pat<(add iPTR:$r, (SPlo tglobaladdr:$in)), (ADDri $r, tglobaladdr:$in)>; +def : Pat<(add iPTR:$r, (SPlo tconstpool:$in)), (ADDri $r, tconstpool:$in)>; // Calls: def : Pat<(call tglobaladdr:$dst), diff --git a/llvm/test/CodeGen/SPARC/globals.ll b/llvm/test/CodeGen/SPARC/globals.ll index 869e9218e2c0..882fe7f51038 100644 --- a/llvm/test/CodeGen/SPARC/globals.ll +++ b/llvm/test/CodeGen/SPARC/globals.ll @@ -1,6 +1,7 @@ ; RUN: llc < %s -march=sparc -relocation-model=static -code-model=small | FileCheck --check-prefix=abs32 %s ; RUN: llc < %s -march=sparcv9 -relocation-model=static -code-model=small | FileCheck --check-prefix=abs32 %s ; RUN: llc < %s -march=sparc -relocation-model=pic -code-model=medium | FileCheck --check-prefix=v8pic32 %s +; RUN: llc < %s -march=sparcv9 -relocation-model=pic -code-model=medium | FileCheck --check-prefix=v9pic32 %s @G = external global i8 @@ -21,3 +22,11 @@ define zeroext i8 @loadG() { ; v8pic32: ld [%[[GOT:[gilo][0-7]]]+%[[Goffs]]], %[[Gaddr:[gilo][0-7]]] ; v8pic32: ldub [%[[Gaddr]]], %i0 ; v8pic32: jmp %i7+8 + +; v9pic32: loadG +; v9pic32: _GLOBAL_OFFSET_TABLE_ +; v9pic32: sethi %hi(G), %[[R1:[gilo][0-7]]] +; v9pic32: add %[[R1]], %lo(G), %[[Goffs:[gilo][0-7]]] +; v9pic32: ldx [%[[GOT:[gilo][0-7]]]+%[[Goffs]]], %[[Gaddr:[gilo][0-7]]] +; v9pic32: ldub [%[[Gaddr]]], %i0 +; v9pic32: jmp %i7+8