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 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 16 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
Sanjay Patel | 4b23fa0 | 2017-06-27 23:15:01 +0000 | [diff] [blame] | 17 | ; CHECK-NEXT: cmpld [[LOAD1]], [[LOAD2]] |
Sanjay Patel | 70b36f1 | 2017-06-27 21:46:34 +0000 | [diff] [blame] | 18 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 0 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 19 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 20 | ; CHECK-NEXT: blr |
| 21 | } |
| 22 | |
| 23 | ; Check size 4 |
| 24 | ; Function Attrs: nounwind readonly |
| 25 | define signext i32 @test2(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 26 | entry: |
| 27 | %0 = bitcast i32* %buffer1 to i8* |
| 28 | %1 = bitcast i32* %buffer2 to i8* |
| 29 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 4) #2 |
| 30 | ret i32 %call |
| 31 | |
| 32 | ; CHECK-LABEL: @test2 |
| 33 | ; CHECK: lwbrx [[LOAD1:[0-9]+]] |
| 34 | ; CHECK-NEXT: lwbrx [[LOAD2:[0-9]+]] |
| 35 | ; CHECK-NEXT: li [[LI:[0-9]+]], 1 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 36 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
Sanjay Patel | 4b23fa0 | 2017-06-27 23:15:01 +0000 | [diff] [blame] | 37 | ; CHECK-NEXT: cmplw [[LOAD1]], [[LOAD2]] |
Sanjay Patel | 70b36f1 | 2017-06-27 21:46:34 +0000 | [diff] [blame] | 38 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 0 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 39 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 40 | ; CHECK-NEXT: blr |
| 41 | } |
| 42 | |
| 43 | ; Check size 2 |
| 44 | ; Function Attrs: nounwind readonly |
| 45 | define signext i32 @test3(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 46 | entry: |
| 47 | %0 = bitcast i32* %buffer1 to i8* |
| 48 | %1 = bitcast i32* %buffer2 to i8* |
| 49 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 2) #2 |
| 50 | ret i32 %call |
| 51 | |
| 52 | ; CHECK-LABEL: @test3 |
| 53 | ; CHECK: lhbrx [[LOAD1:[0-9]+]] |
| 54 | ; CHECK-NEXT: lhbrx [[LOAD2:[0-9]+]] |
| 55 | ; CHECK-NEXT: li [[LI:[0-9]+]], 1 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 56 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
Sanjay Patel | 4b23fa0 | 2017-06-27 23:15:01 +0000 | [diff] [blame] | 57 | ; CHECK-NEXT: cmplw [[LOAD1]], [[LOAD2]] |
Sanjay Patel | 70b36f1 | 2017-06-27 21:46:34 +0000 | [diff] [blame] | 58 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 0 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 59 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 60 | ; CHECK-NEXT: blr |
| 61 | } |
| 62 | |
| 63 | ; Check size 1 |
| 64 | ; Function Attrs: nounwind readonly |
| 65 | define signext i32 @test4(i32* nocapture readonly %buffer1, i32* nocapture readonly %buffer2) local_unnamed_addr #0 { |
| 66 | entry: |
| 67 | %0 = bitcast i32* %buffer1 to i8* |
| 68 | %1 = bitcast i32* %buffer2 to i8* |
| 69 | %call = tail call signext i32 @memcmp(i8* %0, i8* %1, i64 1) #2 |
| 70 | ret i32 %call |
| 71 | |
| 72 | ; CHECK-LABEL: @test4 |
| 73 | ; CHECK: lbz [[LOAD1:[0-9]+]] |
| 74 | ; CHECK-NEXT: lbz [[LOAD2:[0-9]+]] |
Sanjay Patel | 4b23fa0 | 2017-06-27 23:15:01 +0000 | [diff] [blame] | 75 | ; CHECK-NEXT: li [[LI:[0-9]+]], 1 |
| 76 | ; CHECK-NEXT: li [[LI2:[0-9]+]], -1 |
| 77 | ; CHECK-NEXT: cmplw [[LOAD1]], [[LOAD2]] |
| 78 | ; CHECK-NEXT: isel [[ISEL:[0-9]+]], [[LI2]], [[LI]], 0 |
| 79 | ; CHECK-NEXT: isel [[ISEL2:[0-9]+]], 0, [[ISEL]], 2 |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 80 | ; CHECK-NEXT: blr |
| 81 | } |
| 82 | |
| 83 | ; Function Attrs: nounwind readonly |
| 84 | declare signext i32 @memcmp(i8*, i8*, i64) #1 |