brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 5e66b8b Raw
31 lines · plain
1;; Source2;; int square(unsigned short a) {3;;   return a * a;4;; }5;; Command6;; clang -cc1 -triple spir -emit-llvm -O2 -o NoSignedUnsignedWrap.ll test.cl7;;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-SPIRV11;;12;; Negative tests:13;;14; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV-NEGATIVE15;; Check that backend is able to skip nsw/nuw attributes if extension is16;; disabled implicitly or explicitly and if max SPIR-V version is lower then 1.417 18; CHECK-SPIRV-DAG: OpDecorate %[[#]] NoSignedWrap19; CHECK-SPIRV-DAG: OpDecorate %[[#]] NoUnsignedWrap20;21; CHECK-SPIRV-NEGATIVE-NOT: OpExtension "SPV_KHR_no_integer_wrap_decoration"22; CHECK-SPIRV-NEGATIVE-NOT: OpDecorate %[[#]] NoSignedWrap23; CHECK-SPIRV-NEGATIVE-NOT: OpDecorate %[[#]] NoUnsignedWrap24 25define spir_func i32 @square(i16 zeroext %a) local_unnamed_addr {26entry:27  %conv = zext i16 %a to i3228  %mul = mul nuw nsw i32 %conv, %conv29  ret i32 %mul30}31