@@ -121,7 +121,10 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
121
121
setOperationAction (ISD::VACOPY, MVT::Other, Expand);
122
122
setOperationAction (ISD::VAEND, MVT::Other, Expand);
123
123
124
- for (auto T : {MVT::f32, MVT::f64, MVT::v4f32, MVT::v2f64}) {
124
+ for (auto T : {MVT::f32, MVT::f64, MVT::v4f32, MVT::v2f64, MVT::v8f16}) {
125
+ if (!Subtarget->hasFP16 () && T == MVT::v8f16) {
126
+ continue ;
127
+ }
125
128
// Don't expand the floating-point types to constant pools.
126
129
setOperationAction (ISD::ConstantFP, T, Legal);
127
130
// Expand floating-point comparisons.
@@ -140,18 +143,16 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
140
143
// Support minimum and maximum, which otherwise default to expand.
141
144
setOperationAction (ISD::FMINIMUM, T, Legal);
142
145
setOperationAction (ISD::FMAXIMUM, T, Legal);
143
- // WebAssembly currently has no builtin f16 support.
144
- setOperationAction (ISD::FP16_TO_FP, T, Expand);
145
- setOperationAction (ISD::FP_TO_FP16, T, Expand);
146
+ // When experimental v8f16 support is enabled these instructions don't need
147
+ // to be expanded.
148
+ if (T != MVT::v8f16) {
149
+ setOperationAction (ISD::FP16_TO_FP, T, Expand);
150
+ setOperationAction (ISD::FP_TO_FP16, T, Expand);
151
+ }
146
152
setLoadExtAction (ISD::EXTLOAD, T, MVT::f16, Expand);
147
153
setTruncStoreAction (T, MVT::f16, Expand);
148
154
}
149
155
150
- if (Subtarget->hasFP16 ()) {
151
- setOperationAction (ISD::FMINIMUM, MVT::v8f16, Legal);
152
- setOperationAction (ISD::FMAXIMUM, MVT::v8f16, Legal);
153
- }
154
-
155
156
// Expand unavailable integer operations.
156
157
for (auto Op :
157
158
{ISD::BSWAP, ISD::SMUL_LOHI, ISD::UMUL_LOHI, ISD::MULHS, ISD::MULHU,
0 commit comments