
We currently don't extract vector elements from multi-use build vectors unless TLI.aggressivelyPreferBuildVectorSources accepts them, which seems a little extreme for constant build vectors (especially as under some cases ComputeKnownBits will indirectly extract the data for us). This is causing a few regressions in some upcoming SimplifyDemandedBits work I'm looking at, all of which just need to know that the element is zero, so I've tweaked the fold to accept zero elements as well, which will typically fold very easily. Differential Revision: https://reviews.llvm.org/D155582
81 lines
2.4 KiB
LLVM
81 lines
2.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
|
|
; RUN: llc < %s -march=sparc | FileCheck %s
|
|
; RUN: llc < %s -march=sparcel | FileCheck %s --check-prefix=CHECK-LE
|
|
|
|
;; Bitcast should not do a runtime conversion, but rather emit a
|
|
;; constant into integer registers directly.
|
|
|
|
define <2 x i32> @bitcast() nounwind {
|
|
; CHECK-LABEL: bitcast:
|
|
; CHECK: ! %bb.0:
|
|
; CHECK-NEXT: sethi 1049856, %o0
|
|
; CHECK-NEXT: retl
|
|
; CHECK-NEXT: mov %g0, %o1
|
|
;
|
|
; CHECK-LE-LABEL: bitcast:
|
|
; CHECK-LE: ! %bb.0:
|
|
; CHECK-LE-NEXT: sethi 1049856, %o1
|
|
; CHECK-LE-NEXT: retl
|
|
; CHECK-LE-NEXT: mov %g0, %o0
|
|
%1 = bitcast double 5.0 to <2 x i32>
|
|
ret <2 x i32> %1
|
|
}
|
|
|
|
;; Same thing for a call using a double (which gets passed in integer
|
|
;; registers)
|
|
|
|
declare void @a(double)
|
|
define void @test_call() nounwind {
|
|
; CHECK-LABEL: test_call:
|
|
; CHECK: ! %bb.0:
|
|
; CHECK-NEXT: save %sp, -96, %sp
|
|
; CHECK-NEXT: sethi 1049856, %o0
|
|
; CHECK-NEXT: call a
|
|
; CHECK-NEXT: mov %g0, %o1
|
|
; CHECK-NEXT: ret
|
|
; CHECK-NEXT: restore
|
|
;
|
|
; CHECK-LE-LABEL: test_call:
|
|
; CHECK-LE: ! %bb.0:
|
|
; CHECK-LE-NEXT: save %sp, -96, %sp
|
|
; CHECK-LE-NEXT: sethi 1049856, %o1
|
|
; CHECK-LE-NEXT: call a
|
|
; CHECK-LE-NEXT: mov %g0, %o0
|
|
; CHECK-LE-NEXT: ret
|
|
; CHECK-LE-NEXT: restore
|
|
call void @a(double 5.0)
|
|
ret void
|
|
}
|
|
|
|
;; And for a libcall emitted from the pow intrinsic. (libcall
|
|
;; emission happens after SelectionDAG type legalization, so is a bit
|
|
;; different than a normal function call. This was crashing before,
|
|
;; due to an earlier broken workaround for this issue.)
|
|
|
|
declare double @llvm.pow.f64(double, double)
|
|
define double @test_intrins_call() nounwind {
|
|
; CHECK-LABEL: test_intrins_call:
|
|
; CHECK: ! %bb.0:
|
|
; CHECK-NEXT: save %sp, -96, %sp
|
|
; CHECK-NEXT: sethi 1048576, %o0
|
|
; CHECK-NEXT: mov %g0, %o1
|
|
; CHECK-NEXT: mov %o0, %o2
|
|
; CHECK-NEXT: call pow
|
|
; CHECK-NEXT: mov %g0, %o3
|
|
; CHECK-NEXT: ret
|
|
; CHECK-NEXT: restore
|
|
;
|
|
; CHECK-LE-LABEL: test_intrins_call:
|
|
; CHECK-LE: ! %bb.0:
|
|
; CHECK-LE-NEXT: save %sp, -96, %sp
|
|
; CHECK-LE-NEXT: sethi 1048576, %o1
|
|
; CHECK-LE-NEXT: mov %g0, %o0
|
|
; CHECK-LE-NEXT: mov %g0, %o2
|
|
; CHECK-LE-NEXT: call pow
|
|
; CHECK-LE-NEXT: mov %o1, %o3
|
|
; CHECK-LE-NEXT: ret
|
|
; CHECK-LE-NEXT: restore
|
|
%1 = call double @llvm.pow.f64(double 2.0, double 2.0)
|
|
ret double %1
|
|
}
|