Skip to content

Commit

Permalink
[WebAssembly] Fix argument types in SIMD narrowing intrinsics
Browse files Browse the repository at this point in the history
The builtins were updated to take signed parameters in 627a526, but the
intrinsics that use those builtins were not updated as well. The intrinsic test
did not catch this sign mismatch because it is only reported as an error under
-fno-lax-vector-conversions.

This commit fixes the type mismatch and adds -fno-lax-vector-conversions to the
test to catch similar problems in the future.

Differential Revision: https://reviews.llvm.org/D101979
  • Loading branch information
tlively committed May 6, 2021
1 parent f0adf3a commit b198b9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions clang/lib/Headers/wasm_simd128.h
Expand Up @@ -1197,8 +1197,8 @@ wasm_i8x16_narrow_i16x8(v128_t __a, v128_t __b) {

static __inline__ v128_t __DEFAULT_FN_ATTRS
wasm_u8x16_narrow_i16x8(v128_t __a, v128_t __b) {
return (v128_t)__builtin_wasm_narrow_u_i8x16_i16x8((__u16x8)__a,
(__u16x8)__b);
return (v128_t)__builtin_wasm_narrow_u_i8x16_i16x8((__i16x8)__a,
(__i16x8)__b);
}

static __inline__ v128_t __DEFAULT_FN_ATTRS
Expand All @@ -1209,8 +1209,8 @@ wasm_i16x8_narrow_i32x4(v128_t __a, v128_t __b) {

static __inline__ v128_t __DEFAULT_FN_ATTRS
wasm_u16x8_narrow_i32x4(v128_t __a, v128_t __b) {
return (v128_t)__builtin_wasm_narrow_u_i16x8_i32x4((__u32x4)__a,
(__u32x4)__b);
return (v128_t)__builtin_wasm_narrow_u_i16x8_i32x4((__i32x4)__a,
(__i32x4)__b);
}

static __inline__ v128_t __DEFAULT_FN_ATTRS
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Headers/wasm.c
@@ -1,7 +1,7 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --force-update
// REQUIRES: webassembly-registered-target, asserts

// RUN: %clang %s -O2 -emit-llvm -S -o - -target wasm32-unknown-unknown -msimd128 -Wcast-qual -Werror | FileCheck %s
// RUN: %clang %s -O2 -emit-llvm -S -o - -target wasm32-unknown-unknown -msimd128 -Wcast-qual -fno-lax-vector-conversions -Werror | FileCheck %s

#include <wasm_simd128.h>

Expand Down

0 comments on commit b198b9b

Please sign in to comment.