1 ; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK
2 ; RUN: opt -S -dxil-op-lower < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
4 ; Make sure dxil operation function calls for abs are generated for int16_t/int/int64_t.
7 define noundef i16 @abs_i16(i16 noundef %a) {
10 ; EXPCHECK: call i16 @llvm.smax.i16(i16 %a, i16 %{{.*}})
11 ; DOPCHECK: call i16 @dx.op.binary.i16(i32 37, i16 %a, i16 %{{.*}})
12 %elt.abs = call i16 @llvm.abs.i16(i16 %a, i1 false)
16 ; CHECK-LABEL: abs_i32
17 define noundef i32 @abs_i32(i32 noundef %a) {
19 ; CHECK: sub i32 0, %a
20 ; EXPCHECK: call i32 @llvm.smax.i32(i32 %a, i32 %{{.*}})
21 ; DOPCHECK: call i32 @dx.op.binary.i32(i32 37, i32 %a, i32 %{{.*}})
22 %elt.abs = call i32 @llvm.abs.i32(i32 %a, i1 false)
26 ; CHECK-LABEL: abs_i64
27 define noundef i64 @abs_i64(i64 noundef %a) {
29 ; CHECK: sub i64 0, %a
30 ; EXPCHECK: call i64 @llvm.smax.i64(i64 %a, i64 %{{.*}})
31 ; DOPCHECK: call i64 @dx.op.binary.i64(i32 37, i64 %a, i64 %{{.*}})
32 %elt.abs = call i64 @llvm.abs.i64(i64 %a, i1 false)
36 declare i16 @llvm.abs.i16(i16, i1 immarg)
37 declare i32 @llvm.abs.i32(i32, i1 immarg)
38 declare i64 @llvm.abs.i64(i64, i1 immarg)