1 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
2 ; RUN: llc < %s -disable-simplify-libcalls -mtriple=x86_64-linux | FileCheck %s --check-prefix=NOBUILTIN
3 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s
5 ; This tests codegen time inlining/optimization of memcmp
8 @.str = private constant [23 x i8] c"fooooooooooooooooooooo\00", align 1 ; <[23 x i8]*> [#uses=1]
10 declare i32 @memcmp(...)
12 define void @memcmp2(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
14 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 2) nounwind ; <i32> [#uses=1]
15 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
16 br i1 %1, label %return, label %bb
19 store i32 4, i32* %P, align 4
22 return: ; preds = %entry
24 ; CHECK-LABEL: memcmp2:
28 ; NOBUILTIN-LABEL: memcmp2:
32 define void @memcmp2a(i8* %X, i32* nocapture %P) nounwind {
34 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 1), i32 2) nounwind ; <i32> [#uses=1]
35 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
36 br i1 %1, label %return, label %bb
39 store i32 4, i32* %P, align 4
42 return: ; preds = %entry
44 ; CHECK-LABEL: memcmp2a:
46 ; CHECK-NEXT: cmpl $28527,
50 define void @memcmp4(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
52 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 4) nounwind ; <i32> [#uses=1]
53 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
54 br i1 %1, label %return, label %bb
57 store i32 4, i32* %P, align 4
60 return: ; preds = %entry
62 ; CHECK-LABEL: memcmp4:
67 define void @memcmp4a(i8* %X, i32* nocapture %P) nounwind {
69 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 1), i32 4) nounwind ; <i32> [#uses=1]
70 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
71 br i1 %1, label %return, label %bb
74 store i32 4, i32* %P, align 4
77 return: ; preds = %entry
79 ; CHECK-LABEL: memcmp4a:
80 ; CHECK: cmpl $1869573999,
83 define void @memcmp8(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
85 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 8) nounwind ; <i32> [#uses=1]
86 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
87 br i1 %1, label %return, label %bb
90 store i32 4, i32* %P, align 4
93 return: ; preds = %entry
95 ; CHECK-LABEL: memcmp8:
100 define void @memcmp8a(i8* %X, i32* nocapture %P) nounwind {
102 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 0), i32 8) nounwind ; <i32> [#uses=1]
103 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
104 br i1 %1, label %return, label %bb
107 store i32 4, i32* %P, align 4
110 return: ; preds = %entry
112 ; CHECK-LABEL: memcmp8a:
113 ; CHECK: movabsq $8029759185026510694,