[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGen / wmemcmp.c
blob86438a8729eaff594b7a2657c99bcae32d58721f
1 // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -emit-llvm -o - | FileCheck %s
3 typedef __SIZE_TYPE__ size_t;
4 typedef __WCHAR_TYPE__ wchar_t;
6 int wmemcmp_test(const wchar_t *s1, const wchar_t *s2, size_t n) {
7 // CHECK: [[S1:%.*]] = load
8 // CHECK: [[S2:%.*]] = load
9 // CHECK: [[N:%.*]] = load
10 // CHECK: [[N0:%.*]] = icmp eq i64 [[N]], 0
11 // CHECK: br i1 [[N0]], label %[[EXIT:.*]], label %[[GT:.*]]
13 // CHECK: [[GT]]:
14 // CHECK: [[S1P:%.*]] = phi ptr [ [[S1]], %[[ENTRY:.*]] ], [ [[S1N:.*]], %[[NEXT:.*]] ]
15 // CHECK: [[S2P:%.*]] = phi ptr [ [[S2]], %[[ENTRY]] ], [ [[S2N:.*]], %[[NEXT]] ]
16 // CHECK: [[NP:%.*]] = phi i64 [ [[N]], %[[ENTRY]] ], [ [[NN:.*]], %[[NEXT]] ]
17 // CHECK: [[S1L:%.*]] = load i16, ptr [[S1P]], align 2
18 // CHECK: [[S2L:%.*]] = load i16, ptr [[S2P]], align 2
19 // CHECK: [[CMPGT:%.*]] = icmp ugt i16 [[S1L]], [[S2L]]
20 // CHECK: br i1 [[CMPGT]], label %[[EXIT]], label %[[LT:.*]]
22 // CHECK: [[LT]]:
23 // CHECK: [[CMPLT:%.*]] = icmp ult i16 [[S1L]], [[S2L]]
24 // CHECK: br i1 [[CMPLT]], label %[[EXIT]], label %[[NEXT:.*]]
26 // CHECK: [[NEXT]]:
27 // CHECK: [[S1N]] = getelementptr inbounds i16, ptr [[S1P]], i32 1
28 // CHECK: [[S2N]] = getelementptr inbounds i16, ptr [[S2P]], i32 1
29 // CHECK: [[NN]] = sub i64 [[NP]], 1
30 // CHECK: [[NN0:%.*]] = icmp eq i64 [[NN]], 0
31 // CHECK: br i1 [[NN0]], label %[[EXIT]], label %[[GT]]
33 // CHECK: [[EXIT]]:
34 // CHECK: [[RV:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ 1, %[[GT]] ], [ -1, %[[LT]] ], [ 0, %[[NEXT]] ]
35 // CHECK: ret i32 [[RV]]
36 return __builtin_wmemcmp(s1, s2, n);