diff options
author | Thomas Lively <tlively@google.com> | 2018-10-05 00:58:56 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2018-10-05 00:58:56 +0000 |
commit | fc95255e1e776fe5e5c5b01abda208d328aa57b8 (patch) | |
tree | 8086790437a9349fc9a07490c3b34cf96ba61b74 /clang/test/CodeGen/builtins-wasm.c | |
parent | 8295e7812c17ed082aff44449a6309f52ea379be (diff) |
[WebAssembly] saturating arithmetic builtins
Summary: Depends on D52856.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits
Differential Revision: https://reviews.llvm.org/D52858
Diffstat (limited to 'clang/test/CodeGen/builtins-wasm.c')
-rw-r--r-- | clang/test/CodeGen/builtins-wasm.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c index 6a4fcc10113..4dc969dc256 100644 --- a/clang/test/CodeGen/builtins-wasm.c +++ b/clang/test/CodeGen/builtins-wasm.c @@ -172,3 +172,59 @@ f64x2 f24(f64x2 v, double x) { // WEBASSEMBLY: insertelement <2 x double> %v, double %x, i32 1 // WEBASSEMBLY-NEXT: ret } + +i8x16 f25(i8x16 x, i8x16 y) { + return __builtin_wasm_add_saturate_s_i8x16(x, y); + // WEBASSEMBLY: call <16 x i8> @llvm.wasm.add.saturate.signed.v16i8( + // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y) + // WEBASSEMBLY-NEXT: ret +} + +i8x16 f26(i8x16 x, i8x16 y) { + return __builtin_wasm_add_saturate_u_i8x16(x, y); + // WEBASSEMBLY: call <16 x i8> @llvm.wasm.add.saturate.unsigned.v16i8( + // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y) + // WEBASSEMBLY-NEXT: ret +} + +i16x8 f27(i16x8 x, i16x8 y) { + return __builtin_wasm_add_saturate_s_i16x8(x, y); + // WEBASSEMBLY: call <8 x i16> @llvm.wasm.add.saturate.signed.v8i16( + // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y) + // WEBASSEMBLY-NEXT: ret +} + +i16x8 f28(i16x8 x, i16x8 y) { + return __builtin_wasm_add_saturate_u_i16x8(x, y); + // WEBASSEMBLY: call <8 x i16> @llvm.wasm.add.saturate.unsigned.v8i16( + // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y) + // WEBASSEMBLY-NEXT: ret +} + +i8x16 f29(i8x16 x, i8x16 y) { + return __builtin_wasm_sub_saturate_s_i8x16(x, y); + // WEBASSEMBLY: call <16 x i8> @llvm.wasm.sub.saturate.signed.v16i8( + // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y) + // WEBASSEMBLY-NEXT: ret +} + +i8x16 f30(i8x16 x, i8x16 y) { + return __builtin_wasm_sub_saturate_u_i8x16(x, y); + // WEBASSEMBLY: call <16 x i8> @llvm.wasm.sub.saturate.unsigned.v16i8( + // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y) + // WEBASSEMBLY-NEXT: ret +} + +i16x8 f31(i16x8 x, i16x8 y) { + return __builtin_wasm_sub_saturate_s_i16x8(x, y); + // WEBASSEMBLY: call <8 x i16> @llvm.wasm.sub.saturate.signed.v8i16( + // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y) + // WEBASSEMBLY-NEXT: ret +} + +i16x8 f32(i16x8 x, i16x8 y) { + return __builtin_wasm_sub_saturate_u_i16x8(x, y); + // WEBASSEMBLY: call <8 x i16> @llvm.wasm.sub.saturate.unsigned.v8i16( + // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y) + // WEBASSEMBLY-NEXT: ret +} |