Skip to content

Commit 5a46f36

Browse files
zhaoqi5github-actions[bot]
authored andcommitted
Automerge: [LoongArch][NFC] Pre-commit scalarize fp tests for #157824 (#160480)
tests for llvm/llvm-project#157824
2 parents 8a3eda1 + 3a3a4fb commit 5a46f36

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
; RUN: llc --mtriple=loongarch32 -mattr=+32s,+lasx < %s | FileCheck %s
3+
; RUN: llc --mtriple=loongarch64 -mattr=+lasx < %s | FileCheck %s
4+
5+
define <8 x float> @fadd_elt0_v8f32(float %a) nounwind {
6+
; CHECK-LABEL: fadd_elt0_v8f32:
7+
; CHECK: # %bb.0: # %entry
8+
; CHECK-NEXT: # kill: def $f0 killed $f0 def $xr0
9+
; CHECK-NEXT: xvldi $xr1, -1424
10+
; CHECK-NEXT: xvfadd.s $xr0, $xr0, $xr1
11+
; CHECK-NEXT: ret
12+
entry:
13+
%b = insertelement <8 x float> poison, float %a, i32 0
14+
%c = fadd <8 x float> %b, <float 1.0, float poison, float poison, float poison, float poison, float poison, float poison, float poison>
15+
ret <8 x float> %c
16+
}
17+
18+
define <4 x double> @fadd_elt0_v4f64(double %a) nounwind {
19+
; CHECK-LABEL: fadd_elt0_v4f64:
20+
; CHECK: # %bb.0: # %entry
21+
; CHECK-NEXT: # kill: def $f0_64 killed $f0_64 def $xr0
22+
; CHECK-NEXT: xvldi $xr1, -912
23+
; CHECK-NEXT: xvfadd.d $xr0, $xr0, $xr1
24+
; CHECK-NEXT: ret
25+
entry:
26+
%b = insertelement <4 x double> poison, double %a, i32 0
27+
%c = fadd <4 x double> %b, <double 1.0, double poison, double poison, double poison>
28+
ret <4 x double> %c
29+
}
30+
31+
define <8 x float> @fsub_splat_v8f32(float %a, float %b) nounwind {
32+
; CHECK-LABEL: fsub_splat_v8f32:
33+
; CHECK: # %bb.0: # %entry
34+
; CHECK-NEXT: # kill: def $f1 killed $f1 def $vr1
35+
; CHECK-NEXT: # kill: def $f0 killed $f0 def $vr0
36+
; CHECK-NEXT: vfsub.s $vr0, $vr0, $vr1
37+
; CHECK-NEXT: xvpermi.d $xr0, $xr0, 68
38+
; CHECK-NEXT: xvrepl128vei.w $xr0, $xr0, 0
39+
; CHECK-NEXT: ret
40+
entry:
41+
%insa = insertelement <8 x float> poison, float %a, i32 0
42+
%insb = insertelement <8 x float> poison, float %b, i32 0
43+
%va = shufflevector <8 x float> %insa, <8 x float> poison, <8 x i32> zeroinitializer
44+
%vb = shufflevector <8 x float> %insb, <8 x float> poison, <8 x i32> zeroinitializer
45+
%c = fsub <8 x float> %va, %vb
46+
ret <8 x float> %c
47+
}
48+
49+
define <4 x double> @fsub_splat_v4f64(double %a) nounwind {
50+
; CHECK-LABEL: fsub_splat_v4f64:
51+
; CHECK: # %bb.0: # %entry
52+
; CHECK-NEXT: # kill: def $f0_64 killed $f0_64 def $xr0
53+
; CHECK-NEXT: xvldi $xr1, -784
54+
; CHECK-NEXT: xvfadd.d $xr0, $xr0, $xr1
55+
; CHECK-NEXT: xvpermi.d $xr0, $xr0, 0
56+
; CHECK-NEXT: ret
57+
entry:
58+
%insa = insertelement <4 x double> poison, double %a, i32 0
59+
%insb = insertelement <4 x double> poison, double 1.0, i32 0
60+
%va = shufflevector <4 x double> %insa, <4 x double> poison, <4 x i32> zeroinitializer
61+
%vb = shufflevector <4 x double> %insb, <4 x double> poison, <4 x i32> zeroinitializer
62+
%c = fsub <4 x double> %va, %vb
63+
ret <4 x double> %c
64+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
; RUN: llc --mtriple=loongarch32 -mattr=+32s,+lsx < %s | FileCheck %s
3+
; RUN: llc --mtriple=loongarch64 -mattr=+lsx < %s | FileCheck %s
4+
5+
define <4 x float> @fadd_elt0_v4f32(float %a) nounwind {
6+
; CHECK-LABEL: fadd_elt0_v4f32:
7+
; CHECK: # %bb.0: # %entry
8+
; CHECK-NEXT: # kill: def $f0 killed $f0 def $vr0
9+
; CHECK-NEXT: vldi $vr1, -1424
10+
; CHECK-NEXT: vfadd.s $vr0, $vr0, $vr1
11+
; CHECK-NEXT: ret
12+
entry:
13+
%b = insertelement <4 x float> poison, float %a, i32 0
14+
%c = fadd <4 x float> %b, <float 1.0, float poison, float poison, float poison>
15+
ret <4 x float> %c
16+
}
17+
18+
define <2 x double> @fadd_elt0_v2f64(double %a) nounwind {
19+
; CHECK-LABEL: fadd_elt0_v2f64:
20+
; CHECK: # %bb.0: # %entry
21+
; CHECK-NEXT: # kill: def $f0_64 killed $f0_64 def $vr0
22+
; CHECK-NEXT: vldi $vr1, -912
23+
; CHECK-NEXT: vfadd.d $vr0, $vr0, $vr1
24+
; CHECK-NEXT: ret
25+
entry:
26+
%b = insertelement <2 x double> poison, double %a, i32 0
27+
%c = fadd <2 x double> %b, <double 1.0, double poison>
28+
ret <2 x double> %c
29+
}
30+
31+
define <4 x float> @fsub_splat_v4f32(float %b) nounwind {
32+
; CHECK-LABEL: fsub_splat_v4f32:
33+
; CHECK: # %bb.0: # %entry
34+
; CHECK-NEXT: # kill: def $f0 killed $f0 def $vr0
35+
; CHECK-NEXT: vldi $vr1, -1424
36+
; CHECK-NEXT: vfsub.s $vr0, $vr1, $vr0
37+
; CHECK-NEXT: vreplvei.w $vr0, $vr0, 0
38+
; CHECK-NEXT: ret
39+
entry:
40+
%insa = insertelement <4 x float> poison, float 1.0, i32 0
41+
%insb = insertelement <4 x float> poison, float %b, i32 0
42+
%va = shufflevector <4 x float> %insa, <4 x float> poison, <4 x i32> zeroinitializer
43+
%vb = shufflevector <4 x float> %insb, <4 x float> poison, <4 x i32> zeroinitializer
44+
%c = fsub <4 x float> %va, %vb
45+
ret <4 x float> %c
46+
}
47+
48+
define <2 x double> @fsub_splat_v2f64(double %a, double %b) nounwind {
49+
; CHECK-LABEL: fsub_splat_v2f64:
50+
; CHECK: # %bb.0: # %entry
51+
; CHECK-NEXT: # kill: def $f1_64 killed $f1_64 def $vr1
52+
; CHECK-NEXT: # kill: def $f0_64 killed $f0_64 def $vr0
53+
; CHECK-NEXT: vfsub.d $vr0, $vr0, $vr1
54+
; CHECK-NEXT: vreplvei.d $vr0, $vr0, 0
55+
; CHECK-NEXT: ret
56+
entry:
57+
%insa = insertelement <2 x double> poison, double %a, i32 0
58+
%insb = insertelement <2 x double> poison, double %b, i32 0
59+
%va = shufflevector <2 x double> %insa, <2 x double> poison, <2 x i32> zeroinitializer
60+
%vb = shufflevector <2 x double> %insb, <2 x double> poison, <2 x i32> zeroinitializer
61+
%c = fsub <2 x double> %va, %vb
62+
ret <2 x double> %c
63+
}

0 commit comments

Comments
 (0)