diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-01-11 14:53:45 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-01-11 14:53:45 +0000 |
| commit | e0df4650f8f60847af89c92b2dd013c069df86ec (patch) | |
| tree | 1233d371186f3699ee0b015a5e174500b1fa693b | |
| parent | 06fe558246e6b089f251c92fa83fc7b49a667358 (diff) | |
| download | bcm5719-llvm-e0df4650f8f60847af89c92b2dd013c069df86ec.tar.gz bcm5719-llvm-e0df4650f8f60847af89c92b2dd013c069df86ec.zip | |
[InstCombine] add min3-with-nots test (PR35875); NFC
llvm-svn: 322281
| -rw-r--r-- | llvm/test/Transforms/InstCombine/max-of-nots.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/max-of-nots.ll b/llvm/test/Transforms/InstCombine/max-of-nots.ll index 03404e3f147..016147600ed 100644 --- a/llvm/test/Transforms/InstCombine/max-of-nots.ll +++ b/llvm/test/Transforms/InstCombine/max-of-nots.ll @@ -103,6 +103,37 @@ define i8 @umin3_not(i8 %x, i8 %y, i8 %z) { ret i8 %r } +; PR35875 - https://bugs.llvm.org/show_bug.cgi?id=35875 + +define i8 @umin3_not_more_uses(i8 %x, i8 %y, i8 %z) { +; CHECK-LABEL: @umin3_not_more_uses( +; CHECK-NEXT: [[NX:%.*]] = xor i8 %x, -1 +; CHECK-NEXT: [[NY:%.*]] = xor i8 %y, -1 +; CHECK-NEXT: [[NZ:%.*]] = xor i8 %z, -1 +; CHECK-NEXT: [[CMPXZ:%.*]] = icmp ult i8 [[NX]], [[NZ]] +; CHECK-NEXT: [[MINXZ:%.*]] = select i1 [[CMPXZ]], i8 [[NX]], i8 [[NZ]] +; CHECK-NEXT: [[CMPYZ:%.*]] = icmp ult i8 [[NY]], [[NZ]] +; CHECK-NEXT: [[MINYZ:%.*]] = select i1 [[CMPYZ]], i8 [[NY]], i8 [[NZ]] +; CHECK-NEXT: [[CMPYX:%.*]] = icmp ult i8 %y, %x +; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPYX]], i8 [[MINXZ]], i8 [[MINYZ]] +; CHECK-NEXT: call void @extra_use(i8 [[NX]]) +; CHECK-NEXT: call void @extra_use(i8 [[NY]]) +; CHECK-NEXT: ret i8 [[R]] +; + %nx = xor i8 %x, -1 + %ny = xor i8 %y, -1 + %nz = xor i8 %z, -1 + %cmpxz = icmp ult i8 %nx, %nz + %minxz = select i1 %cmpxz, i8 %nx, i8 %nz + %cmpyz = icmp ult i8 %ny, %nz + %minyz = select i1 %cmpyz, i8 %ny, i8 %nz + %cmpyx = icmp ult i8 %y, %x + %r = select i1 %cmpyx, i8 %minxz, i8 %minyz + call void @extra_use(i8 %nx) + call void @extra_use(i8 %ny) + ret i8 %r +} + define i32 @compute_min_3(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @compute_min_3( ; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 %x, %y |

