Skip to content

Commit ed595e8

Browse files
committedMay 24, 2019
[AArch64] Add nvcast patterns for v2f32 -> v1f64
Summary: Constant stores of f32 values can create such NvCast nodes. Reviewers: t.p.northover Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62285 llvm-svn: 361584
1 parent ecd1115 commit ed595e8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6203,6 +6203,7 @@ def : Pat<(v4i16 (AArch64NvCast (v2f32 FPR64:$src))), (v4i16 FPR64:$src)>;
62036203
def : Pat<(v2i32 (AArch64NvCast (v2f32 FPR64:$src))), (v2i32 FPR64:$src)>;
62046204
def : Pat<(v2f32 (AArch64NvCast (v2f32 FPR64:$src))), (v2f32 FPR64:$src)>;
62056205
def : Pat<(v1i64 (AArch64NvCast (v2f32 FPR64:$src))), (v1i64 FPR64:$src)>;
6206+
def : Pat<(v1f64 (AArch64NvCast (v2f32 FPR64:$src))), (v1f64 FPR64:$src)>;
62066207

62076208
// Natural vector casts (128 bit)
62086209
def : Pat<(v16i8 (AArch64NvCast (v4i32 FPR128:$src))), (v16i8 FPR128:$src)>;

‎llvm/test/CodeGen/AArch64/arm64-nvcast.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,15 @@ entry:
4747
store <2 x float> <float 0xC7DFDFDFC0000000, float 0xC7DFDFDFC0000000>, <2 x float>* bitcast (%"st1"* @_gv to <2 x float>*), align 8
4848
ret void
4949
}
50+
51+
%struct.Vector3 = type { float, float, float }
52+
53+
define void @nvcast_v2f32_v1f64(%struct.Vector3*) {
54+
; CHECK-LABEL: _nvcast_v2f32_v1f64
55+
; CHECK: fmov.2s v[[REG:[0-9]+]], #1.00000000
56+
; CHECK: str d[[REG]], [x0]
57+
entry:
58+
%a13 = bitcast %struct.Vector3* %0 to <1 x double>*
59+
store <1 x double> <double 0x3F8000003F800000>, <1 x double>* %a13, align 8
60+
ret void
61+
}

0 commit comments

Comments
 (0)
Please sign in to comment.