From b76f55f74a3436e3bc89efa4779e88d00c3f0bbd Mon Sep 17 00:00:00 2001 From: David Peixotto Date: Mon, 27 Jan 2014 21:39:04 +0000 Subject: [PATCH] Fix unsupported addressing mode assertion for pld Summary: This commit gives an address mode to the PLD instruction. We were getting an assertion failure in the frame lowering code because we had code that was doing a pld of a stack allocated address. The frame lowering was checking the address mode and then asserting because pld had none defined. This commit fixes pld for arm mode. There was a previous fix for thumb mode in a separate commit. The commit for thumb mode added a test in a separate file because it would otherwise fail for arm. This commit moves the thumb test back into the prefetch.ll file and adds the corresponding arm test. Differential Revision: http://llvm-reviews.chandlerc.com/D2622 llvm-svn: 200248 --- llvm/lib/Target/ARM/ARMInstrFormats.td | 4 ++++ llvm/lib/Target/ARM/ARMInstrInfo.td | 4 ++-- llvm/test/CodeGen/ARM/prefetch-thumb.ll | 22 ---------------------- llvm/test/CodeGen/ARM/prefetch.ll | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 llvm/test/CodeGen/ARM/prefetch-thumb.ll diff --git a/llvm/lib/Target/ARM/ARMInstrFormats.td b/llvm/lib/Target/ARM/ARMInstrFormats.td index 9ab82ee8a145..8e3f2c7e2bfc 100644 --- a/llvm/lib/Target/ARM/ARMInstrFormats.td +++ b/llvm/lib/Target/ARM/ARMInstrFormats.td @@ -477,6 +477,10 @@ class AXI pattern> : XI; +class AXIM pattern> + : XI; class AInoP pattern> : InoP read, bits<1> data, string opc> { - def i12 : AXI<(outs), (ins addrmode_imm12:$addr), MiscFrm, IIC_Preload, - !strconcat(opc, "\t$addr"), + def i12 : AXIM<(outs), (ins addrmode_imm12:$addr), AddrMode_i12, MiscFrm, + IIC_Preload, !strconcat(opc, "\t$addr"), [(ARMPreload addrmode_imm12:$addr, (i32 read), (i32 data))]>, Sched<[WritePreLd]> { bits<4> Rt; diff --git a/llvm/test/CodeGen/ARM/prefetch-thumb.ll b/llvm/test/CodeGen/ARM/prefetch-thumb.ll deleted file mode 100644 index e6f6ae8d18b2..000000000000 --- a/llvm/test/CodeGen/ARM/prefetch-thumb.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: llc < %s -march=thumb -mattr=+v7 | FileCheck %s -check-prefix=THUMB2 -; TODO: This test case will be merged back into prefetch.ll when ARM mode issue is solved. - -declare void @llvm.prefetch(i8*, i32, i32, i32) nounwind - -define void @t6() { -entry: -;ARM: t6: -;ARM: pld [sp] -;ARM: pld [sp, #50] - -;THUMB2: t6: -;THUMB2: pld [sp] -;THUMB2: pld [sp, #50] - -%red = alloca [100 x i8], align 1 -%0 = getelementptr inbounds [100 x i8]* %red, i32 0, i32 0 -%1 = getelementptr inbounds [100 x i8]* %red, i32 0, i32 50 -call void @llvm.prefetch(i8* %0, i32 0, i32 3, i32 1) -call void @llvm.prefetch(i8* %1, i32 0, i32 3, i32 1) -ret void -} diff --git a/llvm/test/CodeGen/ARM/prefetch.ll b/llvm/test/CodeGen/ARM/prefetch.ll index 5badb3114814..e6cc849380a1 100644 --- a/llvm/test/CodeGen/ARM/prefetch.ll +++ b/llvm/test/CodeGen/ARM/prefetch.ll @@ -75,3 +75,21 @@ entry: tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 3, i32 0 ) ret void } + +define void @t6() { +entry: +;ARM-LABEL: t6: +;ARM: pld [sp] +;ARM: pld [sp, #50] + +;THUMB2-LABEL: t6: +;THUMB2: pld [sp] +;THUMB2: pld [sp, #50] + +%red = alloca [100 x i8], align 1 +%0 = getelementptr inbounds [100 x i8]* %red, i32 0, i32 0 +%1 = getelementptr inbounds [100 x i8]* %red, i32 0, i32 50 +call void @llvm.prefetch(i8* %0, i32 0, i32 3, i32 1) +call void @llvm.prefetch(i8* %1, i32 0, i32 3, i32 1) +ret void +}