1 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s
4 ; This tests codegen time inlining/optimization of memcmp
7 @.str = private constant [23 x i8] c"fooooooooooooooooooooo\00", align 1 ; <[23 x i8]*> [#uses=1]
9 declare i32 @memcmp(...)
11 define void @memcmp2(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
13 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 2) nounwind ; <i32> [#uses=1]
14 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
15 br i1 %1, label %return, label %bb
18 store i32 4, i32* %P, align 4
21 return: ; preds = %entry
24 ; CHECK: movw ([[A0:%rdi|%rcx]]), %ax
25 ; CHECK: cmpw ([[A1:%rsi|%rdx]]), %ax
28 define void @memcmp2a(i8* %X, i32* nocapture %P) nounwind {
30 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 1), i32 2) nounwind ; <i32> [#uses=1]
31 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
32 br i1 %1, label %return, label %bb
35 store i32 4, i32* %P, align 4
38 return: ; preds = %entry
41 ; CHECK: cmpw $28527, ([[A0]])
45 define void @memcmp4(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
47 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 4) nounwind ; <i32> [#uses=1]
48 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
49 br i1 %1, label %return, label %bb
52 store i32 4, i32* %P, align 4
55 return: ; preds = %entry
58 ; CHECK: movl ([[A0]]), %eax
59 ; CHECK: cmpl ([[A1]]), %eax
62 define void @memcmp4a(i8* %X, i32* nocapture %P) nounwind {
64 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 1), i32 4) nounwind ; <i32> [#uses=1]
65 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
66 br i1 %1, label %return, label %bb
69 store i32 4, i32* %P, align 4
72 return: ; preds = %entry
75 ; CHECK: cmpl $1869573999, ([[A0]])
78 define void @memcmp8(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
80 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* %Y, i32 8) nounwind ; <i32> [#uses=1]
81 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
82 br i1 %1, label %return, label %bb
85 store i32 4, i32* %P, align 4
88 return: ; preds = %entry
91 ; CHECK: movq ([[A0]]), %rax
92 ; CHECK: cmpq ([[A1]]), %rax
95 define void @memcmp8a(i8* %X, i32* nocapture %P) nounwind {
97 %0 = tail call i32 (...)* @memcmp(i8* %X, i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 0), i32 8) nounwind ; <i32> [#uses=1]
98 %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
99 br i1 %1, label %return, label %bb
102 store i32 4, i32* %P, align 4
105 return: ; preds = %entry
108 ; CHECK: movabsq $8029759185026510694, %rax
109 ; CHECK: cmpq %rax, ([[A0]])