Debian Codegraph @

llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll

raw
1 ;; Source
2 ;; int square(unsigned short a) {
3 ;; return a * a;
4 ;; }
5 ;; Command
6 ;; clang -cc1 -triple spir -emit-llvm -O2 -o NoSignedUnsignedWrap.ll test.cl
7 ;;
8 ;; Positive tests:
9 ;;
10 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_KHR_no_integer_wrap_decoration %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV
11 ;;
12 ;; Negative tests:
13 ;;
14 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV-NEGATIVE
15 ;; Check that backend is able to skip nsw/nuw attributes if extension is
16 ;; disabled implicitly or explicitly and if max SPIR-V version is lower then 1.4
17
18 ; CHECK-SPIRV-DAG: OpDecorate %[[#]] NoSignedWrap
19 ; CHECK-SPIRV-DAG: OpDecorate %[[#]] NoUnsignedWrap
20 ;
21 ; CHECK-SPIRV-NEGATIVE-NOT: OpExtension "SPV_KHR_no_integer_wrap_decoration"
22 ; CHECK-SPIRV-NEGATIVE-NOT: OpDecorate %[[#]] NoSignedWrap
23 ; CHECK-SPIRV-NEGATIVE-NOT: OpDecorate %[[#]] NoUnsignedWrap
24
25 define spir_func i32 @square(i16 zeroext %a) local_unnamed_addr {
26 entry:
27 %conv = zext i16 %a to i32
28 %mul = mul nuw nsw i32 %conv, %conv
29 ret i32 %mul
30 }