1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+fp16,+simd128,+relaxed-simd | FileCheck %s --check-prefix=RELAXED
; RUN: llc < %s -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+fp16,+simd128, | FileCheck %s --check-prefix=STRICT
target triple = "wasm32"
define double @fsub_fmul_contract_f64(double %a, double %b, double %c) {
; RELAXED-LABEL: fsub_fmul_contract_f64:
; RELAXED: .functype fsub_fmul_contract_f64 (f64, f64, f64) -> (f64)
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f64.mul $push0=, $1, $0
; RELAXED-NEXT: f64.sub $push1=, $2, $pop0
; RELAXED-NEXT: return $pop1
;
; STRICT-LABEL: fsub_fmul_contract_f64:
; STRICT: .functype fsub_fmul_contract_f64 (f64, f64, f64) -> (f64)
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f64.mul $push0=, $1, $0
; STRICT-NEXT: f64.sub $push1=, $2, $pop0
; STRICT-NEXT: return $pop1
%mul = fmul contract double %b, %a
%sub = fsub contract double %c, %mul
ret double %sub
}
define <4 x float> @fsub_fmul_contract_4xf32(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
; RELAXED-LABEL: fsub_fmul_contract_4xf32:
; RELAXED: .functype fsub_fmul_contract_4xf32 (v128, v128, v128) -> (v128)
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f32x4.relaxed_nmadd $push0=, $2, $1, $0
; RELAXED-NEXT: return $pop0
;
; STRICT-LABEL: fsub_fmul_contract_4xf32:
; STRICT: .functype fsub_fmul_contract_4xf32 (v128, v128, v128) -> (v128)
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f32x4.mul $push0=, $1, $0
; STRICT-NEXT: f32x4.sub $push1=, $2, $pop0
; STRICT-NEXT: return $pop1
%mul = fmul contract <4 x float> %b, %a
%sub = fsub contract <4 x float> %c, %mul
ret <4 x float> %sub
}
define <8 x half> @fsub_fmul_contract_8xf16(<8 x half> %a, <8 x half> %b, <8 x half> %c) {
; RELAXED-LABEL: fsub_fmul_contract_8xf16:
; RELAXED: .functype fsub_fmul_contract_8xf16 (v128, v128, v128) -> (v128)
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f16x8.relaxed_nmadd $push0=, $2, $1, $0
; RELAXED-NEXT: return $pop0
;
; STRICT-LABEL: fsub_fmul_contract_8xf16:
; STRICT: .functype fsub_fmul_contract_8xf16 (v128, v128, v128) -> (v128)
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f16x8.mul $push0=, $1, $0
; STRICT-NEXT: f16x8.sub $push1=, $2, $pop0
; STRICT-NEXT: return $pop1
%mul = fmul contract <8 x half> %b, %a
%sub = fsub contract <8 x half> %c, %mul
ret <8 x half> %sub
}
define <4 x float> @fsub_fmul_4xf32(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
; RELAXED-LABEL: fsub_fmul_4xf32:
; RELAXED: .functype fsub_fmul_4xf32 (v128, v128, v128) -> (v128)
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f32x4.mul $push0=, $1, $0
; RELAXED-NEXT: f32x4.sub $push1=, $2, $pop0
; RELAXED-NEXT: return $pop1
;
; STRICT-LABEL: fsub_fmul_4xf32:
; STRICT: .functype fsub_fmul_4xf32 (v128, v128, v128) -> (v128)
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f32x4.mul $push0=, $1, $0
; STRICT-NEXT: f32x4.sub $push1=, $2, $pop0
; STRICT-NEXT: return $pop1
%mul = fmul <4 x float> %b, %a
%sub = fsub contract <4 x float> %c, %mul
ret <4 x float> %sub
}
define <8 x float> @fsub_fmul_contract_8xf32(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
; RELAXED-LABEL: fsub_fmul_contract_8xf32:
; RELAXED: .functype fsub_fmul_contract_8xf32 (i32, v128, v128, v128, v128, v128, v128) -> ()
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f32x4.relaxed_nmadd $push0=, $6, $4, $2
; RELAXED-NEXT: v128.store 16($0), $pop0
; RELAXED-NEXT: f32x4.relaxed_nmadd $push1=, $5, $3, $1
; RELAXED-NEXT: v128.store 0($0), $pop1
; RELAXED-NEXT: return
;
; STRICT-LABEL: fsub_fmul_contract_8xf32:
; STRICT: .functype fsub_fmul_contract_8xf32 (i32, v128, v128, v128, v128, v128, v128) -> ()
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f32x4.mul $push0=, $4, $2
; STRICT-NEXT: f32x4.sub $push1=, $6, $pop0
; STRICT-NEXT: v128.store 16($0), $pop1
; STRICT-NEXT: f32x4.mul $push2=, $3, $1
; STRICT-NEXT: f32x4.sub $push3=, $5, $pop2
; STRICT-NEXT: v128.store 0($0), $pop3
; STRICT-NEXT: return
%mul = fmul contract <8 x float> %b, %a
%sub = fsub contract <8 x float> %c, %mul
ret <8 x float> %sub
}
define <2 x double> @fsub_fmul_contract_2xf64(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
; RELAXED-LABEL: fsub_fmul_contract_2xf64:
; RELAXED: .functype fsub_fmul_contract_2xf64 (v128, v128, v128) -> (v128)
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f64x2.relaxed_nmadd $push0=, $2, $1, $0
; RELAXED-NEXT: return $pop0
;
; STRICT-LABEL: fsub_fmul_contract_2xf64:
; STRICT: .functype fsub_fmul_contract_2xf64 (v128, v128, v128) -> (v128)
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f64x2.mul $push0=, $1, $0
; STRICT-NEXT: f64x2.sub $push1=, $2, $pop0
; STRICT-NEXT: return $pop1
%mul = fmul contract <2 x double> %b, %a
%sub = fsub contract <2 x double> %c, %mul
ret <2 x double> %sub
}
define float @fsub_fmul_contract_f32(float %a, float %b, float %c) {
; RELAXED-LABEL: fsub_fmul_contract_f32:
; RELAXED: .functype fsub_fmul_contract_f32 (f32, f32, f32) -> (f32)
; RELAXED-NEXT: # %bb.0:
; RELAXED-NEXT: f32.mul $push0=, $1, $0
; RELAXED-NEXT: f32.sub $push1=, $2, $pop0
; RELAXED-NEXT: return $pop1
;
; STRICT-LABEL: fsub_fmul_contract_f32:
; STRICT: .functype fsub_fmul_contract_f32 (f32, f32, f32) -> (f32)
; STRICT-NEXT: # %bb.0:
; STRICT-NEXT: f32.mul $push0=, $1, $0
; STRICT-NEXT: f32.sub $push1=, $2, $pop0
; STRICT-NEXT: return $pop1
%mul = fmul contract float %b, %a
%sub = fsub contract float %c, %mul
ret float %sub
}
|