[llvm] 866bd4d - [NFC] Add test in preparation for D123849.
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 02:16:25 PDT 2022
Author: Clement Courbet
Date: 2022-04-15T11:15:29+02:00
New Revision: 866bd4df477706c6ad1e5d6d2876d7a6eed4def8
URL: https://github.com/llvm/llvm-project/commit/866bd4df477706c6ad1e5d6d2876d7a6eed4def8
DIFF: https://github.com/llvm/llvm-project/commit/866bd4df477706c6ad1e5d6d2876d7a6eed4def8.diff
LOG: [NFC] Add test in preparation for D123849.
Added:
llvm/test/Transforms/ExpandMemCmp/X86/bcmp.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ExpandMemCmp/X86/bcmp.ll b/llvm/test/Transforms/ExpandMemCmp/X86/bcmp.ll
new file mode 100644
index 0000000000000..72d049ddc8980
--- /dev/null
+++ b/llvm/test/Transforms/ExpandMemCmp/X86/bcmp.ll
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -expandmemcmp -memcmp-num-loads-per-block=1 -mtriple=x86_64-unknown-unknown -data-layout=e-m:o-i64:64-f80:128-n8:16:32:64-S128 < %s | FileCheck %s --check-prefix=X64
+
+declare i32 @bcmp(i8* nocapture, i8* nocapture, i64)
+
+define i32 @bcmp8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
+; X64-LABEL: @bcmp8(
+; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
+; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
+; X64-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
+; X64-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
+; X64-NEXT: [[TMP5:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP3]])
+; X64-NEXT: [[TMP6:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP4]])
+; X64-NEXT: [[TMP7:%.*]] = icmp ugt i64 [[TMP5]], [[TMP6]]
+; X64-NEXT: [[TMP8:%.*]] = icmp ult i64 [[TMP5]], [[TMP6]]
+; X64-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
+; X64-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
+; X64-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
+; X64-NEXT: ret i32 [[TMP11]]
+;
+ %call = tail call i32 @bcmp(i8* %x, i8* %y, i64 8)
+ ret i32 %call
+}
+
More information about the llvm-commits
mailing list