2015-03-21 11:36:02 +08:00
|
|
|
; RUN: llc -mcpu=pwr7 < %s | FileCheck %s
|
|
|
|
target datalayout = "E-m:e-i64:64-n32:64"
|
|
|
|
target triple = "powerpc64-unknown-linux-gnu"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
|
|
|
define signext i32 @crbitsoff(i32 signext %v1, i32 signext %v2) #0 {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp ne i32 %v1, 0
|
|
|
|
%lnot = icmp eq i32 %v2, 0
|
|
|
|
%and3 = and i1 %tobool, %lnot
|
|
|
|
%and = zext i1 %and3 to i32
|
|
|
|
ret i32 %and
|
|
|
|
|
|
|
|
; CHECK-LABEL: @crbitsoff
|
|
|
|
; CHECK-DAG: cmplwi {{[0-9]+}}, 3, 0
|
|
|
|
; CHECK-DAG: li [[REG2:[0-9]+]], 1
|
|
|
|
; CHECK-DAG: cntlzw [[REG3:[0-9]+]],
|
[PowerPC] Fix the PPCInstrInfo::getInstrLatency implementation
PowerPC uses itineraries to describe processor pipelines (and dispatch-group
restrictions for P7/P8 cores). Unfortunately, the target-independent
implementation of TII.getInstrLatency calls ItinData->getStageLatency, and that
looks for the largest cycle count in the pipeline for any given instruction.
This, however, yields the wrong answer for the PPC itineraries, because we
don't encode the full pipeline. Because the functional units are fully
pipelined, we only model the initial stages (there are no relevant hazards in
the later stages to model), and so the technique employed by getStageLatency
does not really work. Instead, we should take the maximum output operand
latency, and that's what PPCInstrInfo::getInstrLatency now does.
This caused some test-case churn, including two unfortunate side effects.
First, the new arrangement of copies we get from function parameters now
sometimes blocks VSX FMA mutation (a FIXME has been added to the code and the
test cases), and we have one significant test-suite regression:
SingleSource/Benchmarks/BenchmarkGame/spectral-norm
56.4185% +/- 18.9398%
In this benchmark we have a loop with a vectorized FP divide, and it with the
new scheduling both divides end up in the same dispatch group (which in this
case seems to cause a problem, although why is not exactly clear). The grouping
structure is hard to predict from the bottom of the loop, and there may not be
much we can do to fix this.
Very few other test-suite performance effects were really significant, but
almost all weakly favor this change. However, in light of the issues
highlighted above, I've left the old behavior available via a
command-line flag.
llvm-svn: 242188
2015-07-15 04:02:02 +08:00
|
|
|
; CHECK: isel [[REG4:[0-9]+]], 0, [[REG2]]
|
|
|
|
; CHECK: and 3, [[REG4]], [[REG3]]
|
2015-03-21 11:36:02 +08:00
|
|
|
; CHECK: blr
|
|
|
|
}
|
|
|
|
|
|
|
|
define signext i32 @crbitson(i32 signext %v1, i32 signext %v2) #1 {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp ne i32 %v1, 0
|
|
|
|
%lnot = icmp eq i32 %v2, 0
|
|
|
|
%and3 = and i1 %tobool, %lnot
|
|
|
|
%and = zext i1 %and3 to i32
|
|
|
|
ret i32 %and
|
|
|
|
|
|
|
|
; CHECK-LABEL: @crbitson
|
|
|
|
; CHECK-DAG: cmpwi {{[0-9]+}}, 3, 0
|
|
|
|
; CHECK-DAG: cmpwi {{[0-9]+}}, 4, 0
|
|
|
|
; CHECK-DAG: li [[REG2:[0-9]+]], 1
|
|
|
|
; CHECK-DAG: crorc [[REG3:[0-9]+]],
|
|
|
|
; CHECK: isel 3, 0, [[REG2]], [[REG3]]
|
|
|
|
; CHECK: blr
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone "target-features"="-crbits" }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|