2017-07-01 03:20:54 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2017-06-01 01:12:38 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-gnu-linux < %s | FileCheck %s -check-prefix=CHECK
|
|
|
|
|
2017-07-01 03:20:54 +08:00
|
|
|
define signext i32 @memcmp8(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) {
|
|
|
|
; CHECK-LABEL: memcmp8:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: ldbrx 3, 0, 3
|
|
|
|
; CHECK-NEXT: ldbrx 4, 0, 4
|
2017-12-01 20:02:59 +08:00
|
|
|
; CHECK-NEXT: subfc 5, 3, 4
|
|
|
|
; CHECK-NEXT: subfe 5, 4, 4
|
|
|
|
; CHECK-NEXT: subfc 4, 4, 3
|
|
|
|
; CHECK-NEXT: subfe 3, 3, 3
|
|
|
|
; CHECK-NEXT: neg 4, 5
|
|
|
|
; CHECK-NEXT: neg 3, 3
|
2017-08-01 02:08:24 +08:00
|
|
|
; CHECK-NEXT: subf 3, 3, 4
|
|
|
|
; CHECK-NEXT: extsw 3, 3
|
2017-07-01 03:20:54 +08:00
|
|
|
; CHECK-NEXT: blr
|
|
|
|
%t0 = bitcast i32* %buffer1 to i8*
|
|
|
|
%t1 = bitcast i32* %buffer2 to i8*
|
|
|
|
%call = tail call signext i32 @memcmp(i8* %t0, i8* %t1, i64 8)
|
2017-06-01 01:12:38 +08:00
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
2017-07-01 03:20:54 +08:00
|
|
|
define signext i32 @memcmp4(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) {
|
|
|
|
; CHECK-LABEL: memcmp4:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: lwbrx 3, 0, 3
|
|
|
|
; CHECK-NEXT: lwbrx 4, 0, 4
|
2017-08-01 02:08:24 +08:00
|
|
|
; CHECK-NEXT: sub 5, 4, 3
|
|
|
|
; CHECK-NEXT: sub 3, 3, 4
|
|
|
|
; CHECK-NEXT: rldicl 4, 5, 1, 63
|
|
|
|
; CHECK-NEXT: rldicl 3, 3, 1, 63
|
|
|
|
; CHECK-NEXT: subf 3, 3, 4
|
|
|
|
; CHECK-NEXT: extsw 3, 3
|
2017-07-01 03:20:54 +08:00
|
|
|
; CHECK-NEXT: blr
|
|
|
|
%t0 = bitcast i32* %buffer1 to i8*
|
|
|
|
%t1 = bitcast i32* %buffer2 to i8*
|
|
|
|
%call = tail call signext i32 @memcmp(i8* %t0, i8* %t1, i64 4)
|
2017-06-01 01:12:38 +08:00
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
2017-07-01 03:20:54 +08:00
|
|
|
define signext i32 @memcmp2(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) {
|
|
|
|
; CHECK-LABEL: memcmp2:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: lhbrx 3, 0, 3
|
|
|
|
; CHECK-NEXT: lhbrx 4, 0, 4
|
2017-08-01 02:08:24 +08:00
|
|
|
; CHECK-NEXT: subf 3, 4, 3
|
|
|
|
; CHECK-NEXT: extsw 3, 3
|
2017-07-01 03:20:54 +08:00
|
|
|
; CHECK-NEXT: blr
|
|
|
|
%t0 = bitcast i32* %buffer1 to i8*
|
|
|
|
%t1 = bitcast i32* %buffer2 to i8*
|
|
|
|
%call = tail call signext i32 @memcmp(i8* %t0, i8* %t1, i64 2)
|
2017-06-01 01:12:38 +08:00
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
2017-07-01 03:20:54 +08:00
|
|
|
define signext i32 @memcmp1(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) {
|
|
|
|
; CHECK-LABEL: memcmp1:
|
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: lbz 3, 0(3)
|
|
|
|
; CHECK-NEXT: lbz 4, 0(4)
|
2017-08-01 02:08:24 +08:00
|
|
|
; CHECK-NEXT: subf 3, 4, 3
|
|
|
|
; CHECK-NEXT: extsw 3, 3
|
2017-07-01 03:20:54 +08:00
|
|
|
; CHECK-NEXT: blr
|
|
|
|
%t0 = bitcast i32* %buffer1 to i8*
|
|
|
|
%t1 = bitcast i32* %buffer2 to i8*
|
|
|
|
%call = tail call signext i32 @memcmp(i8* %t0, i8* %t1, i64 1) #2
|
2017-06-01 01:12:38 +08:00
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
2017-07-01 03:20:54 +08:00
|
|
|
declare signext i32 @memcmp(i8*, i8*, i64)
|