Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame^] | 1 | ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-gnu-linux < %s | FileCheck %s -check-prefix=CHECK |
| 2 | |
| 3 | ; Check size 8 |
| 4 | ; Function Attrs: nounwind readonly |
| 5 | define signext i32 @test1(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 6 | entry: |
| 7 | %0 = bitcast i32* %buffer1 to i8* |
| 8 | %1 = bitcast i32* %buffer2 to i8* |
| 9 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 8) #2 |
| 10 | ret i32 %call |
| 11 | |
| 12 | ; CHECK-LABEL: @test1 |
| 13 | ; CHECK: ldbrx [[LOAD1:[0-9]+]] |
| 14 | ; CHECK-NEXT: ldbrx [[LOAD2:[0-9]+]] |
| 15 | ; CHECK-NEXT: li [[LI:[0-9]+]], 1 |
| 16 | ; CHECK-NEXT: cmpld [[CMPLD:[0-9]+]], [[LOAD1]], [[LOAD2]] |
| 17 | ; CHECK-NEXT: subf. [[SUB:[0-9]+]], [[LOAD2]], [[LOAD1]] |
| 18 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
| 19 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 4 |
| 20 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
| 21 | ; CHECK-NEXT: extsw 3, [[ISEL2]] |
| 22 | ; CHECK-NEXT: blr |
| 23 | } |
| 24 | |
| 25 | ; Check size 4 |
| 26 | ; Function Attrs: nounwind readonly |
| 27 | define signext i32 @test2(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 28 | entry: |
| 29 | %0 = bitcast i32* %buffer1 to i8* |
| 30 | %1 = bitcast i32* %buffer2 to i8* |
| 31 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 4) #2 |
| 32 | ret i32 %call |
| 33 | |
| 34 | ; CHECK-LABEL: @test2 |
| 35 | ; CHECK: lwbrx [[LOAD1:[0-9]+]] |
| 36 | ; CHECK-NEXT: lwbrx [[LOAD2:[0-9]+]] |
| 37 | ; CHECK-NEXT: li [[LI:[0-9]+]], 1 |
| 38 | ; CHECK-NEXT: cmpld [[CMPLD:[0-9]+]], [[LOAD1]], [[LOAD2]] |
| 39 | ; CHECK-NEXT: subf. [[SUB:[0-9]+]], [[LOAD2]], [[LOAD1]] |
| 40 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
| 41 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 4 |
| 42 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
| 43 | ; CHECK-NEXT: extsw 3, [[ISEL2]] |
| 44 | ; CHECK-NEXT: blr |
| 45 | } |
| 46 | |
| 47 | ; Check size 2 |
| 48 | ; Function Attrs: nounwind readonly |
| 49 | define signext i32 @test3(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 50 | entry: |
| 51 | %0 = bitcast i32* %buffer1 to i8* |
| 52 | %1 = bitcast i32* %buffer2 to i8* |
| 53 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 2) #2 |
| 54 | ret i32 %call |
| 55 | |
| 56 | ; CHECK-LABEL: @test3 |
| 57 | ; CHECK: lhbrx [[LOAD1:[0-9]+]] |
| 58 | ; CHECK-NEXT: lhbrx [[LOAD2:[0-9]+]] |
| 59 | ; CHECK-NEXT: li [[LI:[0-9]+]], 1 |
| 60 | ; CHECK-NEXT: cmpld [[CMPLD:[0-9]+]], [[LOAD1]], [[LOAD2]] |
| 61 | ; CHECK-NEXT: subf. [[SUB:[0-9]+]], [[LOAD2]], [[LOAD1]] |
| 62 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
| 63 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 4 |
| 64 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
| 65 | ; CHECK-NEXT: extsw 3, [[ISEL2]] |
| 66 | ; CHECK-NEXT: blr |
| 67 | } |
| 68 | |
| 69 | ; Check size 1 |
| 70 | ; Function Attrs: nounwind readonly |
| 71 | define signext i32 @test4(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 72 | entry: |
| 73 | %0 = bitcast i32* %buffer1 to i8* |
| 74 | %1 = bitcast i32* %buffer2 to i8* |
| 75 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 1) #2 |
| 76 | ret i32 %call |
| 77 | |
| 78 | ; CHECK-LABEL: @test4 |
| 79 | ; CHECK: lbz [[LOAD1:[0-9]+]] |
| 80 | ; CHECK-NEXT: lbz [[LOAD2:[0-9]+]] |
| 81 | ; CHECK-NEXT: subf [[SUB:[0-9]+]], [[LOAD2]], [[LOAD1]] |
| 82 | ; CHECK-NEXT: extsw 3, [[SUB]] |
| 83 | ; CHECK-NEXT: blr |
| 84 | } |
| 85 | |
| 86 | ; Function Attrs: nounwind readonly |
| 87 | declare signext i32 @memcmp(i8*, i8*, i64) #1 |