1 // RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2
3 #include <x86intrin.h>
4
test_addcarry_u32(unsigned char __cf,unsigned int __x,unsigned int __y,unsigned int * __p)5 unsigned char test_addcarry_u32(unsigned char __cf, unsigned int __x,
6 unsigned int __y, unsigned int *__p) {
7 // CHECK-LABEL: test_addcarry_u32
8 // CHECK: [[ADC:%.*]] = call { i8, i32 } @llvm.x86.addcarry.32
9 // CHECK: [[DATA:%.*]] = extractvalue { i8, i32 } [[ADC]], 1
10 // CHECK: store i32 [[DATA]], i32* %{{.*}}
11 // CHECK: [[CF:%.*]] = extractvalue { i8, i32 } [[ADC]], 0
12 return _addcarry_u32(__cf, __x, __y, __p);
13 }
14
test_addcarry_u64(unsigned char __cf,unsigned long long __x,unsigned long long __y,unsigned long long * __p)15 unsigned char test_addcarry_u64(unsigned char __cf, unsigned long long __x,
16 unsigned long long __y,
17 unsigned long long *__p) {
18 // CHECK-LABEL: test_addcarry_u64
19 // CHECK: [[ADC:%.*]] = call { i8, i64 } @llvm.x86.addcarry.64
20 // CHECK: [[DATA:%.*]] = extractvalue { i8, i64 } [[ADC]], 1
21 // CHECK: store i64 [[DATA]], i64* %{{.*}}
22 // CHECK: [[CF:%.*]] = extractvalue { i8, i64 } [[ADC]], 0
23 return _addcarry_u64(__cf, __x, __y, __p);
24 }
25
test_subborrow_u32(unsigned char __cf,unsigned int __x,unsigned int __y,unsigned int * __p)26 unsigned char test_subborrow_u32(unsigned char __cf, unsigned int __x,
27 unsigned int __y, unsigned int *__p) {
28 // CHECK-LABEL: test_subborrow_u32
29 // CHECK: [[SBB:%.*]] = call { i8, i32 } @llvm.x86.subborrow.32
30 // CHECK: [[DATA:%.*]] = extractvalue { i8, i32 } [[SBB]], 1
31 // CHECK: store i32 [[DATA]], i32* %{{.*}}
32 // CHECK: [[CF:%.*]] = extractvalue { i8, i32 } [[SBB]], 0
33 return _subborrow_u32(__cf, __x, __y, __p);
34 }
35
test_subborrow_u64(unsigned char __cf,unsigned long long __x,unsigned long long __y,unsigned long long * __p)36 unsigned char test_subborrow_u64(unsigned char __cf, unsigned long long __x,
37 unsigned long long __y,
38 unsigned long long *__p) {
39 // CHECK-LABEL: test_subborrow_u64
40 // CHECK: [[SBB:%.*]] = call { i8, i64 } @llvm.x86.subborrow.64
41 // CHECK: [[DATA:%.*]] = extractvalue { i8, i64 } [[SBB]], 1
42 // CHECK: store i64 [[DATA]], i64* %{{.*}}
43 // CHECK: [[CF:%.*]] = extractvalue { i8, i64 } [[SBB]], 0
44 return _subborrow_u64(__cf, __x, __y, __p);
45 }
46