2012-09-05 20:37:53 +02:00
|
|
|
; RUN: llc -verify-machineinstrs -mtriple=armv7-none-linux-gnueabi -mcpu=cortex-a9 -mattr=+neon,+neonfp -float-abi=hard < %s | FileCheck %s
|
2012-08-30 12:17:45 +02:00
|
|
|
|
|
|
|
define <2 x float> @test_vmovs_via_vext_lane0to0(float %arg, <2 x float> %in) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_vmovs_via_vext_lane0to0:
|
2012-08-30 12:17:45 +02:00
|
|
|
%vec = insertelement <2 x float> %in, float %arg, i32 0
|
|
|
|
%res = fadd <2 x float> %vec, %vec
|
|
|
|
|
|
|
|
; CHECK: vext.32 d1, d1, d0, #1
|
|
|
|
; CHECK: vext.32 d1, d1, d1, #1
|
|
|
|
; CHECK: vadd.f32 {{d[0-9]+}}, d1, d1
|
|
|
|
|
|
|
|
ret <2 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x float> @test_vmovs_via_vext_lane0to1(float %arg, <2 x float> %in) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_vmovs_via_vext_lane0to1:
|
2012-08-30 12:17:45 +02:00
|
|
|
%vec = insertelement <2 x float> %in, float %arg, i32 1
|
|
|
|
%res = fadd <2 x float> %vec, %vec
|
|
|
|
|
|
|
|
; CHECK: vext.32 d1, d1, d1, #1
|
|
|
|
; CHECK: vext.32 d1, d1, d0, #1
|
|
|
|
; CHECK: vadd.f32 {{d[0-9]+}}, d1, d1
|
|
|
|
|
|
|
|
ret <2 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x float> @test_vmovs_via_vext_lane1to0(float, float %arg, <2 x float> %in) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_vmovs_via_vext_lane1to0:
|
2012-08-30 12:17:45 +02:00
|
|
|
%vec = insertelement <2 x float> %in, float %arg, i32 0
|
|
|
|
%res = fadd <2 x float> %vec, %vec
|
|
|
|
|
|
|
|
; CHECK: vext.32 d1, d1, d1, #1
|
|
|
|
; CHECK: vext.32 d1, d0, d1, #1
|
|
|
|
; CHECK: vadd.f32 {{d[0-9]+}}, d1, d1
|
|
|
|
|
|
|
|
ret <2 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x float> @test_vmovs_via_vext_lane1to1(float, float %arg, <2 x float> %in) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_vmovs_via_vext_lane1to1:
|
2012-08-30 12:17:45 +02:00
|
|
|
%vec = insertelement <2 x float> %in, float %arg, i32 1
|
|
|
|
%res = fadd <2 x float> %vec, %vec
|
|
|
|
|
|
|
|
; CHECK: vext.32 d1, d0, d1, #1
|
|
|
|
; CHECK: vext.32 d1, d1, d1, #1
|
|
|
|
; CHECK: vadd.f32 {{d[0-9]+}}, d1, d1
|
|
|
|
|
|
|
|
ret <2 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
define float @test_vmovs_via_vdup(float, float %ret, float %lhs, float %rhs) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_vmovs_via_vdup:
|
2012-08-30 12:17:45 +02:00
|
|
|
|
|
|
|
; Do an operation (which will end up NEON because of +neonfp) to convince the
|
|
|
|
; execution-domain pass that NEON is a good thing to use.
|
|
|
|
%res = fadd float %ret, %ret
|
|
|
|
; It makes sense for LLVM to do the addition in d0 here, because it's going
|
|
|
|
; to be returned. This means it will want a "vmov s0, s1":
|
|
|
|
; CHECK: vdup.32 d0, d0[1]
|
|
|
|
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
2012-09-05 20:37:53 +02:00
|
|
|
declare float @llvm.sqrt.f32(float)
|
|
|
|
|
|
|
|
declare void @bar()
|
|
|
|
|
|
|
|
; This is a comp
|
|
|
|
define float @test_ineligible(float, float %in) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_ineligible:
|
2012-09-05 20:37:53 +02:00
|
|
|
|
|
|
|
%sqrt = call float @llvm.sqrt.f32(float %in)
|
|
|
|
%val = fadd float %sqrt, %sqrt
|
|
|
|
|
|
|
|
; This call forces a move from a callee-saved register to the return-reg. That
|
|
|
|
; move is not eligible for conversion to a d-register instructions because the
|
|
|
|
; use-def chains would be messed up. Primarily a compile-test (we used to
|
|
|
|
; internal fault).
|
|
|
|
call void @bar()
|
2012-12-06 22:24:47 +01:00
|
|
|
; CHECK: bl bar
|
2012-09-29 23:27:31 +02:00
|
|
|
; CHECK: vext.32
|
|
|
|
; CHECK: vext.32
|
2012-09-05 20:37:53 +02:00
|
|
|
ret float %val
|
2012-09-18 10:31:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_vmovs_no_sreg(i32 %in) {
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test_vmovs_no_sreg:
|
2012-09-18 10:31:15 +02:00
|
|
|
|
|
|
|
; Check that the movement to and from GPRs takes place in the NEON domain.
|
|
|
|
; CHECK: vmov.32 d
|
|
|
|
%x = bitcast i32 %in to float
|
|
|
|
|
|
|
|
%res = fadd float %x, %x
|
|
|
|
|
|
|
|
; CHECK: vmov.32 r{{[0-9]+}}, d
|
|
|
|
%resi = bitcast float %res to i32
|
|
|
|
|
|
|
|
ret i32 %resi
|
|
|
|
}
|
2012-11-20 10:56:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
; The point of this test is:
|
|
|
|
; + Make sure s1 is live before the BL
|
|
|
|
; + Make sure s1 is clobbered by the BL
|
|
|
|
; + Convince LLVM to emit a VMOV to S0
|
|
|
|
; + Convince LLVM to domain-convert this.
|
|
|
|
|
|
|
|
; When all of those are satisfied, LLVM should *not* mark s1 as an implicit-use
|
|
|
|
; because it's dead.
|
|
|
|
|
|
|
|
declare float @clobbers_s1(float, float)
|
|
|
|
|
|
|
|
define <2 x float> @test_clobbers_recognised(<2 x float> %invec, float %val) {
|
|
|
|
%elt = call float @clobbers_s1(float %val, float %val)
|
|
|
|
|
|
|
|
%vec = insertelement <2 x float> %invec, float %elt, i32 0
|
|
|
|
%res = fadd <2 x float> %vec, %vec
|
|
|
|
ret <2 x float> %res
|
|
|
|
}
|