Skip to content

Commit

Permalink
Fix implicit pointer type conversions (#7650)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 716756158
  • Loading branch information
dsharletg authored and xnnpack-bot committed Jan 17, 2025
1 parent 6ef4fab commit 854b343
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/f16-avgpool/f16-avgpool-9p8x-minmax-neonfp16arith-c8.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void xnn_f16_avgpool_minmax_ukernel_9p8x__neonfp16arith_c8(
assert(kernel_elements > 9);
assert(channels != 0);

const float16x8_t vscale = vreinterpretq_f16_u16(vld1q_dup_u16(&params->scalar.scale));
const float16x8_t vmin = vreinterpretq_f16_u16(vld1q_dup_u16(&params->scalar.min));
const float16x8_t vmax = vreinterpretq_f16_u16(vld1q_dup_u16(&params->scalar.max));
const float16x8_t vscale = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.scale));
const float16x8_t vmin = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.min));
const float16x8_t vmax = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.max));

do {
{
Expand Down Expand Up @@ -297,7 +297,7 @@ void xnn_f16_avgpool_minmax_ukernel_9p8x__neonfp16arith_c8(
vout_lo = vget_high_f16(vout);
}
if (c & 2) {
vst1_lane_u32((uint16_t*) output, vreinterpret_u32_f16(vout_lo), 0); output = (xnn_float16*) output + 2;
vst1_lane_u32((uint32_t*) output, vreinterpret_u32_f16(vout_lo), 0); output = (xnn_float16*) output + 2;
vout_lo = vext_f16(vout_lo, vout_lo, 2);
}
if (c & 1) {
Expand Down
8 changes: 4 additions & 4 deletions src/f16-avgpool/f16-avgpool-9x-minmax-neonfp16arith-c8.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void xnn_f16_avgpool_minmax_ukernel_9x__neonfp16arith_c8(
assert(kernel_elements <= 9);
assert(channels != 0);

const float16x8_t vscale = vreinterpretq_f16_u16(vld1q_dup_u16(&params->scalar.scale));
const float16x8_t vmin = vreinterpretq_f16_u16(vld1q_dup_u16(&params->scalar.min));
const float16x8_t vmax = vreinterpretq_f16_u16(vld1q_dup_u16(&params->scalar.max));
const float16x8_t vscale = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.scale));
const float16x8_t vmin = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.min));
const float16x8_t vmax = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.max));

do {
const uint16_t* i0 = (const uint16_t*) input[0];
Expand Down Expand Up @@ -162,7 +162,7 @@ void xnn_f16_avgpool_minmax_ukernel_9x__neonfp16arith_c8(
vout_lo = vget_high_f16(vout);
}
if (c & 2) {
vst1_lane_u32((uint16_t*) output, vreinterpret_u32_f16(vout_lo), 0); output = (xnn_float16*) output + 2;
vst1_lane_u32((uint32_t*) output, vreinterpret_u32_f16(vout_lo), 0); output = (xnn_float16*) output + 2;
vout_lo = vext_f16(vout_lo, vout_lo, 2);
}
if (c & 1) {
Expand Down
6 changes: 3 additions & 3 deletions src/reference/binary-elementwise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void binary_ukernel_unquantized(size_t batch_size_bytes, const T* a, const T* b,
const size_t batch_size = batch_size_bytes / sizeof(T);
Operator op;
for (size_t i = 0; i < batch_size; ++i) {
output[i] = op(a[i], b[i]);
output[i] = static_cast<T>(op(a[i], b[i]));
}
}

Expand All @@ -49,7 +49,7 @@ void binaryc_ukernel_unquantized(size_t batch_size_bytes, const T* a,
const T b_0 = *b;
Operator op;
for (size_t i = 0; i < batch_size; ++i) {
output[i] = op(a[i], b_0);
output[i] = static_cast<T>(op(a[i], b_0));
}
}

Expand All @@ -61,7 +61,7 @@ void rbinaryc_ukernel_unquantized(size_t batch_size_bytes, const T* a,
const T b_0 = *b;
Operator op;
for (size_t i = 0; i < batch_size; ++i) {
output[i] = op(b_0, a[i]);
output[i] = static_cast<T>(op(b_0, a[i]));
}
}

Expand Down

0 comments on commit 854b343

Please sign in to comment.