1; Check that various LLVM idioms get lowered to NVPTX as expected.
2
3; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
4; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
5
6; CHECK-LABEL: abs_i16(
7define i16 @abs_i16(i16 %a) {
8; CHECK: abs.s16
9  %neg = sub i16 0, %a
10  %abs.cond = icmp sge i16 %a, 0
11  %abs = select i1 %abs.cond, i16 %a, i16 %neg
12  ret i16 %abs
13}
14
15; CHECK-LABEL: abs_i32(
16define i32 @abs_i32(i32 %a) {
17; CHECK: abs.s32
18  %neg = sub i32 0, %a
19  %abs.cond = icmp sge i32 %a, 0
20  %abs = select i1 %abs.cond, i32 %a, i32 %neg
21  ret i32 %abs
22}
23
24; CHECK-LABEL: abs_i64(
25define i64 @abs_i64(i64 %a) {
26; CHECK: abs.s64
27  %neg = sub i64 0, %a
28  %abs.cond = icmp sge i64 %a, 0
29  %abs = select i1 %abs.cond, i64 %a, i64 %neg
30  ret i64 %abs
31}
32