Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit c32e261

Browse files
committed
X86: Pattern match scalar loads + vcvtph2ps into just vcvtph2ps.
vcvtph2ps only reads the lower 64 bits of the address passed to the intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206579 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 64eed05 commit c32e261

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/Target/X86/X86InstrSSE.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8304,6 +8304,12 @@ let Predicates = [HasF16C] in {
83048304
defm VCVTPH2PSY : f16c_ph2ps<VR256, f128mem, int_x86_vcvtph2ps_256>, VEX_L;
83058305
defm VCVTPS2PH : f16c_ps2ph<VR128, f64mem, int_x86_vcvtps2ph_128>;
83068306
defm VCVTPS2PHY : f16c_ps2ph<VR256, f128mem, int_x86_vcvtps2ph_256>, VEX_L;
8307+
8308+
// Pattern match vcvtph2ps of a scalar i64 load.
8309+
def : Pat<(int_x86_vcvtph2ps_128 (vzmovl_v2i64 addr:$src)),
8310+
(VCVTPH2PSrm addr:$src)>;
8311+
def : Pat<(int_x86_vcvtph2ps_128 (vzload_v2i64 addr:$src)),
8312+
(VCVTPH2PSrm addr:$src)>;
83078313
}
83088314

83098315
//===----------------------------------------------------------------------===//

test/CodeGen/X86/f16c-intrinsics.ll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s -march=x86 -mattr=+avx,+f16c | FileCheck %s
2+
; RUN: llc < %s -march=x86-64 -mattr=+avx,+f16c | FileCheck %s
23

34
define <4 x float> @test_x86_vcvtph2ps_128(<8 x i16> %a0) {
45
; CHECK: vcvtph2ps
@@ -30,3 +31,16 @@ define <8 x i16> @test_x86_vcvtps2ph_256(<8 x float> %a0) {
3031
ret <8 x i16> %res
3132
}
3233
declare <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float>, i32) nounwind readonly
34+
35+
define <4 x float> @test_x86_vcvtps2ph_128_scalar(i64* %ptr) {
36+
; CHECK-LABEL: test_x86_vcvtps2ph_128_scalar
37+
; CHECK-NOT: vmov
38+
; CHECK: vcvtph2ps (%
39+
40+
%load = load i64* %ptr
41+
%ins1 = insertelement <2 x i64> undef, i64 %load, i32 0
42+
%ins2 = insertelement <2 x i64> %ins1, i64 0, i32 1
43+
%bc = bitcast <2 x i64> %ins2 to <8 x i16>
44+
%res = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %bc) #2
45+
ret <4 x float> %res
46+
}

0 commit comments

Comments
 (0)