Optimize FP32 requantization in WAsm SIMD QS8/QC8/QU8 GEMM/IGEMM/DWCONV
PiperOrigin-RevId: 414178544
diff --git a/src/params-init.c b/src/params-init.c
index 286a26d..1067d95 100644
--- a/src/params-init.c
+++ b/src/params-init.c
@@ -314,15 +314,20 @@
uint8_t output_min,
uint8_t output_max)
{
+ const float output_min_less_zero_point = (float) ((int32_t) output_min - (int32_t) output_zero_point);
+ const int32_t magic_min = (int32_t) fp32_to_bits(12582912.0f + output_min_less_zero_point);
+ const int32_t magic_bias_less_zero_point = INT32_C(0x4B400000) - (int32_t) output_zero_point;
for (uint32_t i = 0; i < 8; i++) {
params->fp32_wasmsimd.kernel_zero_point[i] = (int16_t) (uint16_t) kernel_zero_point;
}
for (uint32_t i = 0; i < 4; i++) {
params->fp32_wasmsimd.scale[i] = scale;
- params->fp32_wasmsimd.output_min_less_zero_point[i] = (float) (int32_t) ((uint32_t) output_min - (uint32_t) output_zero_point);
- params->fp32_wasmsimd.output_max_less_zero_point[i] = (float) (int32_t) ((uint32_t) output_max - (uint32_t) output_zero_point);
params->fp32_wasmsimd.magic_bias[i] = 12582912.0f;
- params->fp32_wasmsimd.magic_bias_less_output_zero_point[i] = INT32_C(0x4B400000) - (int32_t) (uint32_t) output_zero_point;
+ params->fp32_wasmsimd.magic_min[i] = magic_min;
+ params->fp32_wasmsimd.magic_bias_less_output_zero_point[i] = magic_bias_less_zero_point;
+ }
+ for (uint32_t i = 0; i < 16; i++) {
+ params->fp32_wasmsimd.output_max[i] = output_max;
}
}
#endif // XNN_ARCH_WASMSIMD
@@ -807,12 +812,17 @@
int8_t output_min,
int8_t output_max)
{
+ const float output_min_less_zero_point = (float) ((int32_t) output_min - (int32_t) output_zero_point);
+ const int32_t magic_min = (int32_t) fp32_to_bits(12582912.0f + output_min_less_zero_point);
+ const int32_t magic_bias_less_zero_point = INT32_C(0x4B400000) - (int32_t) output_zero_point;
for (uint32_t i = 0; i < 4; i++) {
params->fp32_wasmsimd.scale[i] = scale;
- params->fp32_wasmsimd.output_min_less_zero_point[i] = (float) ((int32_t) output_min - (int32_t) output_zero_point);
- params->fp32_wasmsimd.output_max_less_zero_point[i] = (float) ((int32_t) output_max - (int32_t) output_zero_point);
params->fp32_wasmsimd.magic_bias[i] = 12582912.0f;
- params->fp32_wasmsimd.magic_bias_less_output_zero_point[i] = INT32_C(0x4B400000) - (int32_t) output_zero_point;
+ params->fp32_wasmsimd.magic_min[i] = magic_min;
+ params->fp32_wasmsimd.magic_bias_less_output_zero_point[i] = magic_bias_less_zero_point;
+ }
+ for (uint32_t i = 0; i < 16; i++) {
+ params->fp32_wasmsimd.output_max[i] = output_max;
}
}
#endif // XNN_ARCH_WASMSIMD
@@ -948,11 +958,16 @@
int8_t output_min,
int8_t output_max)
{
+ const float output_min_less_zero_point = (float) ((int32_t) output_min - (int32_t) output_zero_point);
+ const int32_t magic_min = (int32_t) fp32_to_bits(12582912.0f + output_min_less_zero_point);
+ const int32_t magic_bias_less_zero_point = INT32_C(0x4B400000) - (int32_t) output_zero_point;
for (uint32_t i = 0; i < 4; i++) {
- params->wasmsimd.output_min_less_zero_point[i] = (float) ((int32_t) output_min - (int32_t) output_zero_point);
- params->wasmsimd.output_max_less_zero_point[i] = (float) ((int32_t) output_max - (int32_t) output_zero_point);
params->wasmsimd.magic_bias[i] = 12582912.0f;
- params->wasmsimd.magic_bias_less_output_zero_point[i] = INT32_C(0x4B400000) - (int32_t) output_zero_point;
+ params->wasmsimd.magic_min[i] = magic_min;
+ params->wasmsimd.magic_bias_less_output_zero_point[i] = magic_bias_less_zero_point;
+ }
+ for (uint32_t i = 0; i < 16; i++) {
+ params->wasmsimd.output_max[i] = output_max;
}
}
#endif // XNN_ARCH_WASMSIMD
diff --git a/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c b/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c
index 8190dec..b1b6ccb 100644
--- a/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c
@@ -487,24 +487,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale89AB);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscaleCDEF);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -516,6 +510,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -739,18 +736,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -758,6 +751,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c b/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
index d71e2ea..74969e3 100644
--- a/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qc8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
@@ -535,24 +535,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale89AB);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscaleCDEF);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -564,6 +558,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -811,18 +808,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -830,6 +823,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c b/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c
index e839e14..289e361 100644
--- a/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c
@@ -215,24 +215,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale89AB);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscaleCDEF);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -244,6 +238,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -339,18 +336,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -358,6 +351,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c b/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
index 1fc349f..bdf45e9 100644
--- a/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qc8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
@@ -231,24 +231,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale89AB);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscaleCDEF);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -260,6 +254,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -363,18 +360,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -382,6 +375,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c b/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c
index 445bb90..a892871 100644
--- a/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c
@@ -596,22 +596,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscaleGHIJ);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscaleKLMN);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -620,6 +604,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -635,6 +627,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -859,18 +855,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -878,6 +870,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c b/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
index aae4c92..95bb3bf 100644
--- a/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qc8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
@@ -668,22 +668,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscaleGHIJ);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscaleKLMN);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -692,6 +676,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -707,6 +699,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -955,18 +951,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -974,6 +966,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c b/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c
index cd76e7c..c59f57a 100644
--- a/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c
@@ -260,22 +260,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscaleGHIJ);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscaleKLMN);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -284,6 +268,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -299,6 +291,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -395,18 +391,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -414,6 +406,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c b/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
index fd57f36..f021969 100644
--- a/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qc8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
@@ -284,22 +284,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscaleGHIJ);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscaleKLMN);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -308,6 +292,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -323,6 +315,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -427,18 +423,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -446,6 +438,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c b/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c
index b66ca7d..b154ac9 100644
--- a/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c
@@ -378,18 +378,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -398,6 +394,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -594,18 +593,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -613,6 +608,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c b/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
index bfd307d..b449ef3 100644
--- a/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qc8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
@@ -402,18 +402,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -422,6 +418,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -642,18 +641,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -661,6 +656,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c b/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c
index cf95d2e..654273a 100644
--- a/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c
@@ -170,18 +170,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -190,6 +186,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -274,18 +273,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -293,6 +288,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c b/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
index 314d2e4..83cf361 100644
--- a/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qc8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
@@ -178,18 +178,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -198,6 +194,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -290,18 +289,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale0123);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale4567);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -309,6 +304,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index b8b8559..09c73a8 100644
--- a/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -105,15 +105,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +118,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index e01a418..9b8639e 100644
--- a/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -103,15 +103,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -119,6 +116,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 6e4ad26..25f5ada 100644
--- a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -80,15 +80,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -96,6 +93,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 2f8fb3e..63bdbf1 100644
--- a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -80,15 +80,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -96,6 +93,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index 87434c3..eb139fd 100644
--- a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -92,15 +92,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -108,6 +105,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index fdeb345..e4d1865 100644
--- a/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qc8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -88,15 +88,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -104,6 +101,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index dccfdc3..1f72985 100644
--- a/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -132,18 +132,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -152,6 +148,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index fec9666..da4a3b0 100644
--- a/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -130,18 +130,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -150,6 +146,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 65fd553..a1d0731 100644
--- a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -101,18 +101,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +117,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index fc3fdc8..e95f115 100644
--- a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -101,18 +101,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +117,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index bb5457c..d9b2b90 100644
--- a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -121,18 +121,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -141,6 +137,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 4fec0f9..024a8da 100644
--- a/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qc8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -117,18 +117,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -137,6 +133,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index f5b064d..6848319 100644
--- a/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -159,21 +159,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -184,6 +179,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 1fbeb7c..89a7179 100644
--- a/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -157,21 +157,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -182,6 +177,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 9255131..300be44 100644
--- a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -122,21 +122,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -147,6 +142,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 9ec32b1..182e2f7 100644
--- a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -122,21 +122,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -147,6 +142,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index 8ab3e1b..8019253 100644
--- a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -150,21 +150,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -175,6 +170,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index d8e5fa6..c6823f0 100644
--- a/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qc8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -146,21 +146,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -171,6 +166,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index dab7127..3a59537 100644
--- a/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -186,24 +186,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -215,6 +209,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 439f78c..1ff47ad 100644
--- a/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -184,24 +184,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -213,6 +207,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 06a6c74..cd1a279 100644
--- a/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -143,24 +143,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -172,6 +166,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 622b192..042399c 100644
--- a/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -143,24 +143,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -172,6 +166,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 1ff60e3..edd7b7e 100644
--- a/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -117,15 +117,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -133,6 +130,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index a90f1be..e70e833 100644
--- a/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -115,15 +115,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -131,6 +128,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 4a76b05..9c59b7d 100644
--- a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -93,15 +93,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -109,6 +106,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 018ca53..bf998ea 100644
--- a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -93,15 +93,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -109,6 +106,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index 029c414..05976c0 100644
--- a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -105,15 +105,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +118,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 6e26a04..3caad01 100644
--- a/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qc8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -101,15 +101,12 @@
w = (const void*) ((const float*) w + 4);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -117,6 +114,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index d54e3d6..0c14f94 100644
--- a/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -146,18 +146,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -166,6 +162,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 7551254..d162f33 100644
--- a/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -144,18 +144,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -164,6 +160,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 4b89dc6..19717d8 100644
--- a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -116,18 +116,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -136,6 +132,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index c04da01..d6a5116 100644
--- a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -116,18 +116,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -136,6 +132,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index 880e4ac..1475964 100644
--- a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -136,18 +136,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -156,6 +152,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 54b4122..4b41157 100644
--- a/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qc8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -132,18 +132,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale0123);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -152,6 +148,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 09cfcbf..44c1613 100644
--- a/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -175,21 +175,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -200,6 +195,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index e9a8899..9748a0f 100644
--- a/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -173,21 +173,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -198,6 +193,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 5b5e794..61b3da2 100644
--- a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -139,21 +139,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -164,6 +159,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 85241aa..e3dff39 100644
--- a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -139,21 +139,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -164,6 +159,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index d17c0fb..df5bd90 100644
--- a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -167,21 +167,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -192,6 +187,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 7a5fd5a..2da544c 100644
--- a/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qc8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -163,21 +163,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale0123);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -188,6 +183,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 41c26e6..5e85f78 100644
--- a/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -204,24 +204,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -233,6 +227,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index b4bc473..cbdf2cd 100644
--- a/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -202,24 +202,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -231,6 +225,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index cd8478b..471d931 100644
--- a/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -162,24 +162,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -191,6 +185,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index be9c7cc..8403c87 100644
--- a/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qc8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -162,24 +162,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale0123);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale0123);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -191,6 +185,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c b/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c
index 00f47ed..677204e 100644
--- a/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16-add16.c
@@ -482,24 +482,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -511,6 +505,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -732,18 +729,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -751,6 +744,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c b/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
index a6a2269..373cb91 100644
--- a/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
@@ -530,24 +530,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -559,6 +553,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -804,18 +801,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -823,6 +816,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c b/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c
index 3d41edb..8d01eba 100644
--- a/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16-add16.c
@@ -210,24 +210,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -239,6 +233,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -332,18 +329,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -351,6 +344,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c b/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
index b89a72c..438e124 100644
--- a/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
@@ -226,24 +226,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -255,6 +249,9 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -356,18 +353,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -375,6 +368,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c b/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c
index 8dcc284..110b2fd 100644
--- a/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16-add16.c
@@ -589,22 +589,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscale);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -613,6 +597,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -628,6 +620,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -850,18 +846,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -869,6 +861,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c b/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
index a604af3..d12f4e1 100644
--- a/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
@@ -661,22 +661,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscale);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -685,6 +669,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -700,6 +692,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -946,18 +942,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -965,6 +957,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c b/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c
index c4560b1..f478eeb 100644
--- a/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16-add16.c
@@ -253,22 +253,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscale);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -277,6 +261,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -292,6 +284,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -386,18 +382,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -405,6 +397,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c b/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
index 9e31184..9a7d20a 100644
--- a/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
@@ -277,22 +277,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscale);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -301,6 +285,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -316,6 +308,10 @@
v128_t vout0123456789ABCDEF = wasm_i8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_i8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_i8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_i8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -418,18 +414,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -437,6 +429,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c b/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c
index 0158362..1d7a188 100644
--- a/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16-add16.c
@@ -375,18 +375,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -395,6 +391,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -589,18 +588,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -608,6 +603,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c b/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
index 0311274..93f33e6 100644
--- a/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
@@ -399,18 +399,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -419,6 +415,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -637,18 +636,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -656,6 +651,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c b/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c
index b892b28..28e3585 100644
--- a/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c
+++ b/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16-add16.c
@@ -167,18 +167,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -187,6 +183,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -269,18 +268,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -288,6 +283,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c b/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
index 656ffb1..2b9a887 100644
--- a/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
@@ -175,18 +175,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -195,6 +191,9 @@
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -285,18 +284,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -304,6 +299,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_i8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_i8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qs8-dwconv/unipass-wasmsimd-mul16.c.in b/src/qs8-dwconv/unipass-wasmsimd-mul16.c.in
index 2801f9a..e08f6f5 100644
--- a/src/qs8-dwconv/unipass-wasmsimd-mul16.c.in
+++ b/src/qs8-dwconv/unipass-wasmsimd-mul16.c.in
@@ -24,6 +24,7 @@
$WASM_X32X4_EXTEND_LOW_X16X8 = "wasm_u32x4_extend_low_u16x8" if DATATYPE == "QU8" else "wasm_i32x4_extend_low_i16x8"
$WASM_X32X4_EXTEND_HIGH_X16X8 = "wasm_u32x4_extend_high_u16x8" if DATATYPE == "QU8" else "wasm_i32x4_extend_high_i16x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
+$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_dwconv_minmax_${REQUANTIZATION.lower()}_ukernel_up${CHANNEL_TILE}x${KERNEL_TILE}__wasmsimd_mul16${"_add16" if ADD16 else ""}(
size_t channels,
size_t output_width,
@@ -110,18 +111,14 @@
$for C in range(0, CHANNEL_TILE, 4):
vacc${ABC[C:C+4]} = wasm_f32x4_mul(vacc${ABC[C:C+4]}, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for C in range(0, CHANNEL_TILE, 4):
- vacc${ABC[C:C+4]} = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${ABC[C:C+4]});
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for C in range(0, CHANNEL_TILE, 4):
- vacc${ABC[C:C+4]} = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${ABC[C:C+4]});
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for C in range(0, CHANNEL_TILE, 4):
vacc${ABC[C:C+4]} = wasm_f32x4_add(vacc${ABC[C:C+4]}, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for C in range(0, CHANNEL_TILE, 4):
+ vacc${ABC[C:C+4]} = wasm_i32x4_max(vacc${ABC[C:C+4]}, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for C in range(0, CHANNEL_TILE, 4):
vacc${ABC[C:C+4]} = wasm_i32x4_sub(vacc${ABC[C:C+4]}, vmagic_bias_less_output_zero_point);
@@ -135,6 +132,13 @@
$else:
v128_t vout${ABC[C:C+8]}${ABC[C:C+8]} = ${WASM_X8X16_NARROW_I16X8}(vout${ABC[C:C+8]}, vout${ABC[C:C+8]});
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ $for C in range(0, CHANNEL_TILE, 16):
+ $if C + 8 < CHANNEL_TILE:
+ vout${ABC[C:C+16]} = ${WASM_X8X16_MIN}(vout${ABC[C:C+16]}, voutput_max);
+ $else:
+ vout${ABC[C:C+8]}${ABC[C:C+8]} = ${WASM_X8X16_MIN}(vout${ABC[C:C+8]}${ABC[C:C+8]}, voutput_max);
+
$if CHANNEL_TILE > 8:
wasm_v128_store(output, vout${ABC[0:16]});
$else:
@@ -204,18 +208,14 @@
vacc${ABC[0:4]} = wasm_f32x4_mul(vacc${ABC[0:4]}, vscale);
vacc${ABC[4:8]} = wasm_f32x4_mul(vacc${ABC[4:8]}, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- vacc${ABC[0:4]} = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${ABC[0:4]});
- vacc${ABC[4:8]} = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${ABC[4:8]});
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- vacc${ABC[0:4]} = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${ABC[0:4]});
- vacc${ABC[4:8]} = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${ABC[4:8]});
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
vacc${ABC[0:4]} = wasm_f32x4_add(vacc${ABC[0:4]}, vmagic_bias);
vacc${ABC[4:8]} = wasm_f32x4_add(vacc${ABC[4:8]}, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ vacc${ABC[0:4]} = wasm_i32x4_max(vacc${ABC[0:4]}, vmagic_min);
+ vacc${ABC[4:8]} = wasm_i32x4_max(vacc${ABC[4:8]}, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
vacc${ABC[0:4]} = wasm_i32x4_sub(vacc${ABC[0:4]}, vmagic_bias_less_output_zero_point);
vacc${ABC[4:8]} = wasm_i32x4_sub(vacc${ABC[4:8]}, vmagic_bias_less_output_zero_point);
@@ -223,6 +223,9 @@
v128_t vout${ABC[0:8]} = wasm_i16x8_narrow_i32x4(vacc${ABC[0:4]}, vacc${ABC[4:8]});
v128_t vout${ABC[0:8]}${ABC[0:8]} = ${WASM_X8X16_NARROW_I16X8}(vout${ABC[0:8]}, vout${ABC[0:8]});
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout${ABC[0:8]}${ABC[0:8]} = ${WASM_X8X16_MIN}(vout${ABC[0:8]}${ABC[0:8]}, voutput_max);
+
$if CHANNEL_TILE > 8:
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
diff --git a/src/qs8-gemm/MRx4c2-wasmsimd-dot16x2.c.in b/src/qs8-gemm/MRx4c2-wasmsimd-dot16x2.c.in
index c820075..86c8902 100644
--- a/src/qs8-gemm/MRx4c2-wasmsimd-dot16x2.c.in
+++ b/src/qs8-gemm/MRx4c2-wasmsimd-dot16x2.c.in
@@ -23,6 +23,7 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
+$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_gemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c2__wasmsimd_dot16x2${LOAD_SUFFIX}(
size_t mr,
size_t nc,
@@ -194,18 +195,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -218,6 +215,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in range(MR):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-gemm/MRx4c8-wasmsimd-dot16x2.c.in b/src/qs8-gemm/MRx4c8-wasmsimd-dot16x2.c.in
index b1d7f3d..64ec17b 100644
--- a/src/qs8-gemm/MRx4c8-wasmsimd-dot16x2.c.in
+++ b/src/qs8-gemm/MRx4c8-wasmsimd-dot16x2.c.in
@@ -22,6 +22,7 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
+$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_gemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c8__wasmsimd_dot16x2${LOAD_SUFFIX}(
size_t mr,
size_t nc,
@@ -147,18 +148,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -171,6 +168,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in range(MR):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-gemm/MRx4c8-wasmsimd-mul16.c.in b/src/qs8-gemm/MRx4c8-wasmsimd-mul16.c.in
index bc3b4f2..d44ef51 100644
--- a/src/qs8-gemm/MRx4c8-wasmsimd-mul16.c.in
+++ b/src/qs8-gemm/MRx4c8-wasmsimd-mul16.c.in
@@ -22,7 +22,6 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
-$WASM_X8X16_MAX = "wasm_u8x16_max" if DATATYPE == "QU8" else "wasm_i8x16_max"
$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_gemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c8__wasmsimd_mul16${LOAD_SUFFIX}(
size_t mr,
@@ -159,18 +158,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -183,6 +178,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in range(MR):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-gemm/MRx4c8-wasmsimd-mul32.c.in b/src/qs8-gemm/MRx4c8-wasmsimd-mul32.c.in
index d6abeaf..39e010c 100644
--- a/src/qs8-gemm/MRx4c8-wasmsimd-mul32.c.in
+++ b/src/qs8-gemm/MRx4c8-wasmsimd-mul32.c.in
@@ -22,7 +22,6 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
-$WASM_X8X16_MAX = "wasm_u8x16_max" if DATATYPE == "QU8" else "wasm_i8x16_max"
$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_gemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c8__wasmsimd_mul32${LOAD_SUFFIX}(
size_t mr,
@@ -152,18 +151,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -176,6 +171,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in range(MR):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 23813f6..25fe2cb 100644
--- a/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -104,15 +104,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -120,6 +117,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 57e86eb..2dac3a6 100644
--- a/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -102,15 +102,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -118,6 +115,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/1x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
index 2f33c7f..3c910e9 100644
--- a/src/qs8-gemm/gen/1x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/1x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -102,15 +102,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -118,6 +115,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index ce80c67..15f7c96 100644
--- a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -79,15 +79,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -95,6 +92,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 216f6db..ccf9d17 100644
--- a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -79,15 +79,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -95,6 +92,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index eb916c1..fe5af86 100644
--- a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -91,15 +91,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -107,6 +104,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index aeaae8a..b97a8cd 100644
--- a/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qs8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -87,15 +87,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -103,6 +100,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
index 5697817..ea27ecc 100644
--- a/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -79,15 +79,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -95,6 +92,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-mul16.c b/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-mul16.c
index 6d89b86..f963204 100644
--- a/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-gemm/gen/1x4c8-xw-minmax-fp32-wasmsimd-mul16.c
@@ -87,15 +87,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -103,6 +100,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 072992f..9924dbf 100644
--- a/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -131,18 +131,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -151,6 +147,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 57d4f64..b579033 100644
--- a/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -129,18 +129,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -149,6 +145,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/2x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
index 9a37c50..53aeea7 100644
--- a/src/qs8-gemm/gen/2x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/2x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -129,18 +129,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -149,6 +145,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 35c4f6f..0b9a2c2 100644
--- a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -100,18 +100,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -120,6 +116,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index bd48436..980cdbc 100644
--- a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -100,18 +100,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -120,6 +116,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index ff00b69..337037c 100644
--- a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -120,18 +120,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -140,6 +136,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 04c2f8e..0c18a08 100644
--- a/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qs8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -116,18 +116,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -136,6 +132,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
index 9a6365b..ac67218 100644
--- a/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -100,18 +100,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -120,6 +116,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-mul16.c b/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-mul16.c
index aaed106..2671344 100644
--- a/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-gemm/gen/2x4c8-xw-minmax-fp32-wasmsimd-mul16.c
@@ -116,18 +116,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -136,6 +132,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 765706a..d3a33c1 100644
--- a/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -158,21 +158,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -183,6 +178,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 0a8a8b0..90eec30 100644
--- a/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -156,21 +156,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -181,6 +176,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/3x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
index c23dc20..8b5122e 100644
--- a/src/qs8-gemm/gen/3x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/3x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -156,21 +156,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -181,6 +176,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index c4a91dc..a4f5292 100644
--- a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -121,21 +121,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -146,6 +141,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index b75d3d2..a4de050 100644
--- a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -121,21 +121,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -146,6 +141,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index c70deef..898f646 100644
--- a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -149,21 +149,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -174,6 +169,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 40e2fb3..de4eae1 100644
--- a/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qs8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -145,21 +145,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -170,6 +165,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
index 04fd506..00b3d4b 100644
--- a/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -121,21 +121,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -146,6 +141,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-mul16.c b/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-mul16.c
index 8cb5bb5..33018f1 100644
--- a/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qs8-gemm/gen/3x4c8-xw-minmax-fp32-wasmsimd-mul16.c
@@ -145,21 +145,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -170,6 +165,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 1479d2c..e9f35ad 100644
--- a/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -185,24 +185,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -214,6 +208,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index fb7af03..5c63007 100644
--- a/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -183,24 +183,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -212,6 +206,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/4x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/4x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
index a1f9974..e2854a5 100644
--- a/src/qs8-gemm/gen/4x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/4x4c2-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -183,24 +183,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -212,6 +206,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index b71b6b4..79484b2 100644
--- a/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -142,24 +142,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -171,6 +165,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 519e430..c348a81 100644
--- a/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -142,24 +142,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -171,6 +165,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-gemm/gen/4x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c b/src/qs8-gemm/gen/4x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
index b982ceb..d9ee9ee 100644
--- a/src/qs8-gemm/gen/4x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
+++ b/src/qs8-gemm/gen/4x4c8-xw-minmax-fp32-wasmsimd-dot16x2.c
@@ -142,24 +142,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -171,6 +165,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/MRx4c2-wasmsimd-dot16x2.c.in b/src/qs8-igemm/MRx4c2-wasmsimd-dot16x2.c.in
index 0eb4168..a52798f 100644
--- a/src/qs8-igemm/MRx4c2-wasmsimd-dot16x2.c.in
+++ b/src/qs8-igemm/MRx4c2-wasmsimd-dot16x2.c.in
@@ -20,6 +20,7 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
+$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_igemm_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c2__wasmsimd_dot16x2_${VARIANT.lower()}(
size_t mr,
size_t nc,
@@ -180,18 +181,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -204,6 +201,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in reversed(range(MR)):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-igemm/MRx4c8-wasmsimd-dot16x2.c.in b/src/qs8-igemm/MRx4c8-wasmsimd-dot16x2.c.in
index 13db441..9593eae 100644
--- a/src/qs8-igemm/MRx4c8-wasmsimd-dot16x2.c.in
+++ b/src/qs8-igemm/MRx4c8-wasmsimd-dot16x2.c.in
@@ -23,6 +23,7 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
+$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_igemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c8__wasmsimd_dot16x2${LOAD_SUFFIX}(
size_t mr,
size_t nc,
@@ -158,18 +159,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -182,6 +179,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in reversed(range(MR)):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-igemm/MRx4c8-wasmsimd-mul16.c.in b/src/qs8-igemm/MRx4c8-wasmsimd-mul16.c.in
index 388ce07..a8052d3 100644
--- a/src/qs8-igemm/MRx4c8-wasmsimd-mul16.c.in
+++ b/src/qs8-igemm/MRx4c8-wasmsimd-mul16.c.in
@@ -22,7 +22,6 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
-$WASM_X8X16_MAX = "wasm_u8x16_max" if DATATYPE == "QU8" else "wasm_i8x16_max"
$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_igemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c8__wasmsimd_mul16${LOAD_SUFFIX}(
size_t mr,
@@ -169,18 +168,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -193,6 +188,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in reversed(range(MR)):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-igemm/MRx4c8-wasmsimd-mul32.c.in b/src/qs8-igemm/MRx4c8-wasmsimd-mul32.c.in
index 8fb8ff9..ba857a4 100644
--- a/src/qs8-igemm/MRx4c8-wasmsimd-mul32.c.in
+++ b/src/qs8-igemm/MRx4c8-wasmsimd-mul32.c.in
@@ -22,7 +22,6 @@
$XINT8_T = "uint8_t" if DATATYPE == "QU8" else "int8_t"
$WASM_X16X8_LOAD8X8 = "wasm_u16x8_load8x8" if DATATYPE == "QU8" else "wasm_i16x8_load8x8"
$WASM_X8X16_NARROW_I16X8 = "wasm_u8x16_narrow_i16x8" if DATATYPE == "QU8" else "wasm_i8x16_narrow_i16x8"
-$WASM_X8X16_MAX = "wasm_u8x16_max" if DATATYPE == "QU8" else "wasm_i8x16_max"
$WASM_X8X16_MIN = "wasm_u8x16_min" if DATATYPE == "QU8" else "wasm_i8x16_min"
void xnn_${DATATYPE.lower()}_igemm${GEMM_SUFFIX}_minmax_${REQUANTIZATION.lower()}_ukernel_${MR}x4c8__wasmsimd_mul32${LOAD_SUFFIX}(
size_t mr,
@@ -162,18 +161,14 @@
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_mul(vacc${M}x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_min_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc${M}x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.output_max_less_zero_point);
- $for M in range(MR):
- vacc${M}x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc${M}x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias);
$for M in range(MR):
vacc${M}x0123 = wasm_f32x4_add(vacc${M}x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->${PARAMS_STRUCT}.magic_min);
+ $for M in range(MR):
+ vacc${M}x0123 = wasm_i32x4_max(vacc${M}x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->${PARAMS_STRUCT}.magic_bias_less_output_zero_point);
$for M in range(MR):
vacc${M}x0123 = wasm_i32x4_sub(vacc${M}x0123, vmagic_bias_less_output_zero_point);
@@ -186,6 +181,9 @@
$else:
v128_t vout = ${WASM_X8X16_NARROW_I16X8}(vacc0${min(1, MR-1)}x0123, vacc0${min(1, MR-1)}x0123);
+ const v128_t voutput_max = wasm_v128_load(params->${PARAMS_STRUCT}.output_max);
+ vout = ${WASM_X8X16_MIN}(vout, voutput_max);
+
if (nc >= 4) {
$for M in reversed(range(MR)):
*((float*) c${M}) = (float) wasm_f32x4_extract_lane(vout, ${M});
diff --git a/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 3e016a7..5aecba1 100644
--- a/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -116,15 +116,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -132,6 +129,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index fecf4c2..a4ee9f0 100644
--- a/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -114,15 +114,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -130,6 +127,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 87b9415..7791484 100644
--- a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -92,15 +92,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -108,6 +105,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 3df8336..42b106f 100644
--- a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -92,15 +92,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -108,6 +105,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index aa978ce..3797019 100644
--- a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -104,15 +104,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -120,6 +117,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index 10165af..5cf23b4 100644
--- a/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qs8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -100,15 +100,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -116,6 +113,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 41036bf..972c48f 100644
--- a/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -145,18 +145,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -165,6 +161,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 8b9ea61..6deb58e 100644
--- a/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -143,18 +143,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -163,6 +159,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 2f87437..aeebfd3 100644
--- a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -115,18 +115,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -135,6 +131,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index dafae0a..037cbde 100644
--- a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -115,18 +115,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -135,6 +131,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index 4eb1442..98f8c40 100644
--- a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -135,18 +135,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -155,6 +151,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index cb9773d..b92fcec 100644
--- a/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qs8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -131,18 +131,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -151,6 +147,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 1fdcdfc..a7d65ac 100644
--- a/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -174,21 +174,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -199,6 +194,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 0d7d177..86c85e0 100644
--- a/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -172,21 +172,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -197,6 +192,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 1653462..24eda4f 100644
--- a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -138,21 +138,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -163,6 +158,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 35ba5ef..112d76d 100644
--- a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -138,21 +138,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -163,6 +158,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
index 3b5ac6b..da2311f 100644
--- a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
+++ b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld128.c
@@ -166,21 +166,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -191,6 +186,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
index dfdb410..d2f0cdb 100644
--- a/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
+++ b/src/qs8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul16-ld64.c
@@ -162,21 +162,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -187,6 +182,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 28d5e4c..be8da9e 100644
--- a/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -203,24 +203,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -232,6 +226,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index dbf0b91..772fd8f 100644
--- a/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -201,24 +201,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -230,6 +224,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index d3fd484..4a1e7dc 100644
--- a/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -161,24 +161,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -190,6 +184,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index db62f52..bf87e00 100644
--- a/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qs8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -161,24 +161,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -190,6 +184,9 @@
v128_t vout = wasm_i8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_i8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qu8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c b/src/qu8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
index 7a774b9..d48c2da 100644
--- a/src/qu8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qu8-dwconv/gen/up16x25-minmax-fp32-wasmsimd-mul16.c
@@ -583,24 +583,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -612,6 +606,9 @@
v128_t vout0123456789ABCDEF = wasm_u8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_u8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -883,18 +880,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -902,6 +895,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qu8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c b/src/qu8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
index fa8b520..440bbf8 100644
--- a/src/qu8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qu8-dwconv/gen/up16x9-minmax-fp32-wasmsimd-mul16.c
@@ -247,24 +247,18 @@
vacc89AB = wasm_f32x4_mul(vacc89AB, vscale);
vaccCDEF = wasm_f32x4_mul(vaccCDEF, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
vacc89AB = wasm_f32x4_add(vacc89AB, vmagic_bias);
vaccCDEF = wasm_f32x4_add(vaccCDEF, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -276,6 +270,9 @@
v128_t vout0123456789ABCDEF = wasm_u8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_u8x16_min(vout0123456789ABCDEF, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
output += 16;
}
@@ -387,18 +384,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -406,6 +399,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qu8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c b/src/qu8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
index c13aeb0..791c8e5 100644
--- a/src/qu8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qu8-dwconv/gen/up24x25-minmax-fp32-wasmsimd-mul16.c
@@ -740,22 +740,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscale);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -764,6 +748,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -779,6 +771,10 @@
v128_t vout0123456789ABCDEF = wasm_u8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_u8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_u8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_u8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -1051,18 +1047,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -1070,6 +1062,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qu8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c b/src/qu8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
index 3ede002..aff0184 100644
--- a/src/qu8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qu8-dwconv/gen/up24x9-minmax-fp32-wasmsimd-mul16.c
@@ -308,22 +308,6 @@
vaccGHIJ = wasm_f32x4_mul(vaccGHIJ, vscale);
vaccKLMN = wasm_f32x4_mul(vaccKLMN, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmax(voutput_min_less_zero_point, vaccKLMN);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
- vacc89AB = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc89AB);
- vaccCDEF = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccCDEF);
- vaccGHIJ = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccGHIJ);
- vaccKLMN = wasm_f32x4_pmin(voutput_max_less_zero_point, vaccKLMN);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
@@ -332,6 +316,14 @@
vaccGHIJ = wasm_f32x4_add(vaccGHIJ, vmagic_bias);
vaccKLMN = wasm_f32x4_add(vaccKLMN, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+ vacc89AB = wasm_i32x4_max(vacc89AB, vmagic_min);
+ vaccCDEF = wasm_i32x4_max(vaccCDEF, vmagic_min);
+ vaccGHIJ = wasm_i32x4_max(vaccGHIJ, vmagic_min);
+ vaccKLMN = wasm_i32x4_max(vaccKLMN, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -347,6 +339,10 @@
v128_t vout0123456789ABCDEF = wasm_u8x16_narrow_i16x8(vout01234567, vout89ABCDEF);
v128_t voutGHIJKLMNGHIJKLMN = wasm_u8x16_narrow_i16x8(voutGHIJKLMN, voutGHIJKLMN);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456789ABCDEF = wasm_u8x16_min(vout0123456789ABCDEF, voutput_max);
+ voutGHIJKLMNGHIJKLMN = wasm_u8x16_min(voutGHIJKLMNGHIJKLMN, voutput_max);
+
wasm_v128_store(output, vout0123456789ABCDEF);
*((double*) (output + 16)) = wasm_f64x2_extract_lane(voutGHIJKLMNGHIJKLMN, 0);
output += 24;
@@ -459,18 +455,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -478,6 +470,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
w = (const void*) ((uintptr_t) w + 8 * sizeof(int32_t));
if XNN_LIKELY(c >= 8) {
diff --git a/src/qu8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c b/src/qu8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
index 8b2a82d..ed8cf30 100644
--- a/src/qu8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qu8-dwconv/gen/up8x25-minmax-fp32-wasmsimd-mul16.c
@@ -426,18 +426,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -446,6 +442,9 @@
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -690,18 +689,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -709,6 +704,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qu8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c b/src/qu8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
index 9018794..059291c 100644
--- a/src/qu8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
+++ b/src/qu8-dwconv/gen/up8x9-minmax-fp32-wasmsimd-mul16.c
@@ -186,18 +186,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -206,6 +202,9 @@
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
*((double*) output) = wasm_f64x2_extract_lane(vout0123456701234567, 0);
output += 8;
}
@@ -306,18 +305,14 @@
vacc0123 = wasm_f32x4_mul(vacc0123, vscale);
vacc4567 = wasm_f32x4_mul(vacc4567, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc4567);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0123);
- vacc4567 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc4567);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0123 = wasm_f32x4_add(vacc0123, vmagic_bias);
vacc4567 = wasm_f32x4_add(vacc4567, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0123 = wasm_i32x4_max(vacc0123, vmagic_min);
+ vacc4567 = wasm_i32x4_max(vacc4567, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0123 = wasm_i32x4_sub(vacc0123, vmagic_bias_less_output_zero_point);
vacc4567 = wasm_i32x4_sub(vacc4567, vmagic_bias_less_output_zero_point);
@@ -325,6 +320,9 @@
v128_t vout01234567 = wasm_i16x8_narrow_i32x4(vacc0123, vacc4567);
v128_t vout0123456701234567 = wasm_u8x16_narrow_i16x8(vout01234567, vout01234567);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout0123456701234567 = wasm_u8x16_min(vout0123456701234567, voutput_max);
+
if (c & 4) {
*((float*) output) = wasm_f32x4_extract_lane(vout0123456701234567, 0);
diff --git a/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 706c45b..906da57 100644
--- a/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -105,15 +105,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +118,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index ca98cfc..8e35a3b 100644
--- a/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -103,15 +103,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -119,6 +116,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 2f956c6..67593c4 100644
--- a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -80,15 +80,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -96,6 +93,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 585edc1..a7d8881 100644
--- a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -80,15 +80,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -96,6 +93,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
index 9aea1d6..e210673 100644
--- a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
+++ b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
@@ -84,15 +84,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -100,6 +97,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
index 02cc1017f..48cdd00 100644
--- a/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
+++ b/src/qu8-gemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
@@ -84,15 +84,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -100,6 +97,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index e0fe686..b25fb7d 100644
--- a/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -132,18 +132,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -152,6 +148,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 281ad24..1554965 100644
--- a/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -130,18 +130,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -150,6 +146,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index f1b7b41..d64d634 100644
--- a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -101,18 +101,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +117,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index d387d15..ce92af5 100644
--- a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -101,18 +101,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -121,6 +117,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
index 5772a94..d74997b 100644
--- a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
+++ b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
@@ -109,18 +109,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -129,6 +125,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
index da968ba..c0324e3 100644
--- a/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
+++ b/src/qu8-gemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
@@ -109,18 +109,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -129,6 +125,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index b569cab..691504e 100644
--- a/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -159,21 +159,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -184,6 +179,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index de7193f..99e6bb8 100644
--- a/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -157,21 +157,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -182,6 +177,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index c380702..5b8c284 100644
--- a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -122,21 +122,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -147,6 +142,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 9c6308a..f11b1d0 100644
--- a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -122,21 +122,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -147,6 +142,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
index c392d41..7c4290b 100644
--- a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
+++ b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
@@ -134,21 +134,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -159,6 +154,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
index efadb7d..83bb225 100644
--- a/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
+++ b/src/qu8-gemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
@@ -134,21 +134,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -159,6 +154,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index d5e87d8..0270f12 100644
--- a/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -186,24 +186,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -215,6 +209,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 456c591..f4d09c4 100644
--- a/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -184,24 +184,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -213,6 +207,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 6d3e171..1515534 100644
--- a/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -143,24 +143,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -172,6 +166,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index d5256b4..b44dfe8 100644
--- a/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-gemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -143,24 +143,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -172,6 +166,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 14d7784..c161858 100644
--- a/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -117,15 +117,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -133,6 +130,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 6057e97..978a087 100644
--- a/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/1x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -115,15 +115,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -131,6 +128,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index e88fcb0..499d9fb 100644
--- a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -93,15 +93,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -109,6 +106,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 89e70ec..6bf7993 100644
--- a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -93,15 +93,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -109,6 +106,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
index c5f7b93..128d5e7 100644
--- a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
+++ b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
@@ -97,15 +97,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -113,6 +110,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
index 9b64b87..05ec522 100644
--- a/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
+++ b/src/qu8-igemm/gen/1x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
@@ -97,15 +97,12 @@
const v128_t vscale = wasm_v128_load(params->fp32_wasmsimd.scale);
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
@@ -113,6 +110,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc00x0123, vacc00x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 22119bf..aec097f 100644
--- a/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -146,18 +146,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -166,6 +162,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 92062f7..2128670 100644
--- a/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/2x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -144,18 +144,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -164,6 +160,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index f645b18..de15a1f 100644
--- a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -116,18 +116,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -136,6 +132,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 084e832..6e8d4b6 100644
--- a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -116,18 +116,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -136,6 +132,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
index 1d3784e..7ddca6a 100644
--- a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
+++ b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
@@ -124,18 +124,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -144,6 +140,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
index 36d7aa6..9d7f974 100644
--- a/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
+++ b/src/qu8-igemm/gen/2x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
@@ -124,18 +124,14 @@
vacc0x0123 = wasm_f32x4_mul(vacc0x0123, vscale);
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -144,6 +140,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc01x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
*((float*) c0) = (float) wasm_f32x4_extract_lane(vout, 0);
diff --git a/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 898a1a9..0e3b58f 100644
--- a/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -175,21 +175,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -200,6 +195,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index ee4e633..8a9a4a5 100644
--- a/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/3x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -173,21 +173,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -198,6 +193,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index b9d06d4..8b4402e 100644
--- a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -139,21 +139,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -164,6 +159,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 3bf05b2..58885dc 100644
--- a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -139,21 +139,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -164,6 +159,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
index 940bd5b..3f869a1 100644
--- a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
+++ b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld128.c
@@ -151,21 +151,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -176,6 +171,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
index 384b17c..3167f09 100644
--- a/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
+++ b/src/qu8-igemm/gen/3x4c8-minmax-fp32-wasmsimd-mul32-ld64.c
@@ -151,21 +151,16 @@
vacc1x0123 = wasm_f32x4_mul(vacc1x0123, vscale);
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -176,6 +171,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc22x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
*((float*) c1) = (float) wasm_f32x4_extract_lane(vout, 1);
diff --git a/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 6f17afe..ac5d8d5 100644
--- a/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -204,24 +204,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -233,6 +227,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 23e920e..2759754 100644
--- a/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/4x4c2-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -202,24 +202,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -231,6 +225,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c b/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
index 40531de..4852181 100644
--- a/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
+++ b/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld128.c
@@ -162,24 +162,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -191,6 +185,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c b/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
index 75b8690..77b627d 100644
--- a/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
+++ b/src/qu8-igemm/gen/4x4c8-minmax-fp32-wasmsimd-dot16x2-ld64.c
@@ -162,24 +162,18 @@
vacc2x0123 = wasm_f32x4_mul(vacc2x0123, vscale);
vacc3x0123 = wasm_f32x4_mul(vacc3x0123, vscale);
- const v128_t voutput_min_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_min_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmax(voutput_min_less_zero_point, vacc3x0123);
-
- const v128_t voutput_max_less_zero_point = wasm_v128_load(params->fp32_wasmsimd.output_max_less_zero_point);
- vacc0x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc0x0123);
- vacc1x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc1x0123);
- vacc2x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc2x0123);
- vacc3x0123 = wasm_f32x4_pmin(voutput_max_less_zero_point, vacc3x0123);
-
const v128_t vmagic_bias = wasm_v128_load(params->fp32_wasmsimd.magic_bias);
vacc0x0123 = wasm_f32x4_add(vacc0x0123, vmagic_bias);
vacc1x0123 = wasm_f32x4_add(vacc1x0123, vmagic_bias);
vacc2x0123 = wasm_f32x4_add(vacc2x0123, vmagic_bias);
vacc3x0123 = wasm_f32x4_add(vacc3x0123, vmagic_bias);
+ const v128_t vmagic_min = wasm_v128_load(params->fp32_wasmsimd.magic_min);
+ vacc0x0123 = wasm_i32x4_max(vacc0x0123, vmagic_min);
+ vacc1x0123 = wasm_i32x4_max(vacc1x0123, vmagic_min);
+ vacc2x0123 = wasm_i32x4_max(vacc2x0123, vmagic_min);
+ vacc3x0123 = wasm_i32x4_max(vacc3x0123, vmagic_min);
+
const v128_t vmagic_bias_less_output_zero_point = wasm_v128_load(params->fp32_wasmsimd.magic_bias_less_output_zero_point);
vacc0x0123 = wasm_i32x4_sub(vacc0x0123, vmagic_bias_less_output_zero_point);
vacc1x0123 = wasm_i32x4_sub(vacc1x0123, vmagic_bias_less_output_zero_point);
@@ -191,6 +185,9 @@
v128_t vout = wasm_u8x16_narrow_i16x8(vacc01x0123, vacc23x0123);
+ const v128_t voutput_max = wasm_v128_load(params->fp32_wasmsimd.output_max);
+ vout = wasm_u8x16_min(vout, voutput_max);
+
if (nc >= 4) {
*((float*) c3) = (float) wasm_f32x4_extract_lane(vout, 3);
*((float*) c2) = (float) wasm_f32x4_extract_lane(vout, 2);
diff --git a/src/xnnpack/params.h b/src/xnnpack/params.h
index 67c5b56..1050139 100644
--- a/src/xnnpack/params.h
+++ b/src/xnnpack/params.h
@@ -381,10 +381,10 @@
struct {
XNN_ALIGN(16) int16_t kernel_zero_point[8];
XNN_ALIGN(16) float scale[4];
- XNN_ALIGN(16) float output_min_less_zero_point[4];
- XNN_ALIGN(16) float output_max_less_zero_point[4];
XNN_ALIGN(16) float magic_bias[4];
+ XNN_ALIGN(16) int32_t magic_min[4];
XNN_ALIGN(16) int32_t magic_bias_less_output_zero_point[4];
+ XNN_ALIGN(16) int8_t output_max[16];
} fp32_wasmsimd;
#endif // XNN_ARCH_WASMSIMD
};
@@ -438,10 +438,10 @@
#endif // XNN_ARCH_X86 || XNN_ARCH_X86_64
#if XNN_ARCH_WASMSIMD
struct {
- XNN_ALIGN(16) float output_min_less_zero_point[4];
- XNN_ALIGN(16) float output_max_less_zero_point[4];
XNN_ALIGN(16) float magic_bias[4];
+ XNN_ALIGN(16) int32_t magic_min[4];
XNN_ALIGN(16) int32_t magic_bias_less_output_zero_point[4];
+ XNN_ALIGN(16) int8_t output_max[16];
} wasmsimd;
#endif // XNN_ARCH_WASMSIMD
};
@@ -586,10 +586,10 @@
} gemmlowp_wasmsimd;
struct {
XNN_ALIGN(16) float scale[4];
- XNN_ALIGN(16) float output_min_less_zero_point[4];
- XNN_ALIGN(16) float output_max_less_zero_point[4];
XNN_ALIGN(16) float magic_bias[4];
+ XNN_ALIGN(16) int32_t magic_min[4];
XNN_ALIGN(16) int32_t magic_bias_less_output_zero_point[4];
+ XNN_ALIGN(16) int8_t output_max[16];
} fp32_wasmsimd;
#endif // XNN_ARCH_WASMSIMD
};