1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 @.str1 = private constant [4 x i8] c"\00\00\00\00", align 1
5 @.str2 = private constant [4 x i8] c"\ff\ff\ff\ff", align 1
7 declare i32 @memcmp(i8*, i8*, i64)
9 define i32 @length4_same() nounwind {
10 ; CHECK-LABEL: length4_same:
12 ; CHECK-NEXT: xorl %eax, %eax
14 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
15 %m = tail call i32 @memcmp(i8* %s1, i8* %s1, i64 4) nounwind
19 define i1 @length4_same_lt() nounwind {
20 ; CHECK-LABEL: length4_same_lt:
22 ; CHECK-NEXT: xorl %eax, %eax
24 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
25 %m = tail call i32 @memcmp(i8* %s1, i8* %s1, i64 4) nounwind
26 %c = icmp slt i32 %m, 0
30 define i1 @length4_same_gt() nounwind {
31 ; CHECK-LABEL: length4_same_gt:
33 ; CHECK-NEXT: xorl %eax, %eax
35 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
36 %m = tail call i32 @memcmp(i8* %s1, i8* %s1, i64 4) nounwind
37 %c = icmp sgt i32 %m, 0
41 define i1 @length4_same_le() nounwind {
42 ; CHECK-LABEL: length4_same_le:
44 ; CHECK-NEXT: movb $1, %al
46 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
47 %m = tail call i32 @memcmp(i8* %s1, i8* %s1, i64 4) nounwind
48 %c = icmp sle i32 %m, 0
52 define i1 @length4_same_ge() nounwind {
53 ; CHECK-LABEL: length4_same_ge:
55 ; CHECK-NEXT: movb $1, %al
57 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
58 %m = tail call i32 @memcmp(i8* %s1, i8* %s1, i64 4) nounwind
59 %c = icmp sge i32 %m, 0
64 define i32 @length4() nounwind {
65 ; CHECK-LABEL: length4:
67 ; CHECK-NEXT: movl $-1, %eax
69 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
70 %s2 = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
71 %m = tail call i32 @memcmp(i8* %s1, i8* %s2, i64 4) nounwind
75 define i1 @length4_lt() nounwind {
76 ; CHECK-LABEL: length4_lt:
78 ; CHECK-NEXT: movb $1, %al
80 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
81 %s2 = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
82 %m = tail call i32 @memcmp(i8* %s1, i8* %s2, i64 4) nounwind
83 %c = icmp slt i32 %m, 0
87 define i1 @length4_gt() nounwind {
88 ; CHECK-LABEL: length4_gt:
90 ; CHECK-NEXT: xorl %eax, %eax
92 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
93 %s2 = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
94 %m = tail call i32 @memcmp(i8* %s1, i8* %s2, i64 4) nounwind
95 %c = icmp sgt i32 %m, 0
99 define i1 @length4_le() nounwind {
100 ; CHECK-LABEL: length4_le:
102 ; CHECK-NEXT: movb $1, %al
104 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
105 %s2 = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
106 %m = tail call i32 @memcmp(i8* %s1, i8* %s2, i64 4) nounwind
107 %c = icmp sle i32 %m, 0
111 define i1 @length4_ge() nounwind {
112 ; CHECK-LABEL: length4_ge:
114 ; CHECK-NEXT: xorl %eax, %eax
116 %s1 = getelementptr inbounds [4 x i8], [4 x i8]* @.str1, i32 0, i32 0
117 %s2 = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
118 %m = tail call i32 @memcmp(i8* %s1, i8* %s2, i64 4) nounwind
119 %c = icmp sge i32 %m, 0