Avoid extra register movement when lowering the x86 scalar_to_vector of a float value

This commit is contained in:
Andrew Brown
2019-08-22 13:59:32 -07:00
parent 00bedca274
commit 3dfc68afb1
5 changed files with 76 additions and 25 deletions

View File

@@ -24,8 +24,7 @@ ebb0:
v0 = f32const 0x42.42
v1 = vconst.f32x4 [0x00.00 0x00.00 0x00.00 0x42.42]
v2 = extractlane v1, 3
v10 = f32const 0x42.42 ; TODO this should not be necessary, v0 should be re-usable
v3 = fcmp eq v2, v10
v3 = fcmp eq v2, v0
return v3
}
; run

View File

@@ -17,10 +17,10 @@ ebb0:
return
}
function %test_scalar_to_vector_f32() {
function %test_scalar_to_vector_b32() {
ebb0:
[-, %rcx] v0 = f32const 0x0.42
[-, %xmm3] v1 = scalar_to_vector.f32x4 v0 ; bin: 66 0f 6e d9
[-, %rcx] v0 = bconst.b32 false
[-, %xmm3] v1 = scalar_to_vector.b32x4 v0 ; bin: 66 0f 6e d9
return
}

View File

@@ -0,0 +1,19 @@
test compile
set opt_level=best
set probestack_enabled=false
set enable_simd
target x86_64
; ensure that scalar_to_vector emits no instructions for floats (already exist in an XMM register)
function %test_scalar_to_vector_f32() -> f32x4 baldrdash_system_v {
ebb0:
v0 = f32const 0x0.42
v1 = scalar_to_vector.f32x4 v0
return v1
}
; check: ebb0
; nextln: v2 = iconst.i32 0x3e84_0000
; nextln: v0 = bitcast.f32 v2
; nextln: [null_fpr#00,%xmm0] v1 = scalar_to_vector.f32x4 v0
; nextln: return v1