Skip to content

Commit

Permalink
[NFC] Add test in preparation for D123849.
Browse files Browse the repository at this point in the history
  • Loading branch information
legrosbuffle committed Apr 15, 2022
1 parent afa7c5d commit 866bd4d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions llvm/test/Transforms/ExpandMemCmp/X86/bcmp.ll
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 866bd4d

Please sign in to comment.