| 1 |
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -filetype=obj -o - | spirv-val %} |
| 3 |
; XFAIL: * |
| 4 |
;@llvm.sadd.with.overflow and @llvm.ssub.with.overflow has not been implemented. |
| 5 |
|
| 6 |
define spir_func void @test_sadd_overflow(ptr %out_result, ptr %out_overflow, i32 %a, i32 %b) { |
| 7 |
entry: |
| 8 |
%res = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) |
| 9 |
%val = extractvalue { i32, i1 } %res, 0 |
| 10 |
%ofl = extractvalue { i32, i1 } %res, 1 |
| 11 |
store i32 %val, ptr %out_result |
| 12 |
%zext_ofl = zext i1 %ofl to i8 |
| 13 |
store i8 %zext_ofl, ptr %out_overflow |
| 14 |
ret void |
| 15 |
} |
| 16 |
|
| 17 |
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) |
| 18 |
|
| 19 |
define spir_func void @test_ssub_overflow(ptr %out_result, ptr %out_overflow, i32 %a, i32 %b) { |
| 20 |
entry: |
| 21 |
%res = call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 %a, i32 %b) |
| 22 |
%val = extractvalue { i32, i1 } %res, 0 |
| 23 |
%ofl = extractvalue { i32, i1 } %res, 1 |
| 24 |
store i32 %val, ptr %out_result |
| 25 |
%zext_ofl = zext i1 %ofl to i8 |
| 26 |
store i8 %zext_ofl, ptr %out_overflow |
| 27 |
ret void |
| 28 |
} |
| 29 |
|
| 30 |
declare { i32, i1 } @llvm.ssub.with.overflow.i32(i32, i32) |