[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / builtin-abs.c
blob791395368a8c01441c7a410ebbeab0ff056ec16c
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
3 int absi(int x) {
4 // CHECK-LABEL: @absi(
5 // CHECK: [[NEG:%.*]] = sub nsw i32 0, [[X:%.*]]
6 // CHECK: [[CMP:%.*]] = icmp slt i32 [[X]], 0
7 // CHECK: [[SEL:%.*]] = select i1 [[CMP]], i32 [[NEG]], i32 [[X]]
8 //
9 return __builtin_abs(x);
12 long absl(long x) {
13 // CHECK-LABEL: @absl(
14 // CHECK: [[NEG:%.*]] = sub nsw i64 0, [[X:%.*]]
15 // CHECK: [[CMP:%.*]] = icmp slt i64 [[X]], 0
16 // CHECK: [[SEL:%.*]] = select i1 [[CMP]], i64 [[NEG]], i64 [[X]]
18 return __builtin_labs(x);
21 long long absll(long long x) {
22 // CHECK-LABEL: @absll(
23 // CHECK: [[NEG:%.*]] = sub nsw i64 0, [[X:%.*]]
24 // CHECK: [[CMP:%.*]] = icmp slt i64 [[X]], 0
25 // CHECK: [[SEL:%.*]] = select i1 [[CMP]], i64 [[NEG]], i64 [[X]]
27 return __builtin_llabs(x);