From 1dce7b19a06742fe8bf7bf1948a8dfdcb71dd118 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Wed, 3 Dec 2014 00:19:17 +0000 Subject: [PATCH] [PowerPC] Fix readcyclecounter to be custom expanded for all 32-bit targets We need to use the custom expansion of readcyclecounter on all 32-bit targets (even those with 64-bit registers). This should fix the ppc64 buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223182 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCISelLowering.cpp | 8 +++----- test/CodeGen/PowerPC/ppc32-cyclecounter.ll | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 3668a87b0ec..d913f3bbf7c 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -599,12 +599,10 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM) } } - if (Subtarget.has64BitSupport()) { + if (Subtarget.has64BitSupport()) setOperationAction(ISD::PREFETCH, MVT::Other, Legal); - setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, Legal); - } else { - setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, Custom); - } + + setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, isPPC64 ? Legal : Custom); if (!isPPC64) { setOperationAction(ISD::ATOMIC_LOAD, MVT::i64, Expand); diff --git a/test/CodeGen/PowerPC/ppc32-cyclecounter.ll b/test/CodeGen/PowerPC/ppc32-cyclecounter.ll index 75d24c38348..9e2cd0b1288 100644 --- a/test/CodeGen/PowerPC/ppc32-cyclecounter.ll +++ b/test/CodeGen/PowerPC/ppc32-cyclecounter.ll @@ -1,6 +1,7 @@ target datalayout = "E-m:e-p:32:32-i64:64-n32" target triple = "powerpc" -; RUN: llc < %s | FileCheck %s +; RUN: llc -mcpu=ppc < %s | FileCheck %s +; RUN: llc -mcpu=pwr7 < %s | FileCheck %s define i64 @test1() nounwind { entry: -- 2.34.1