Skip to content

Commit 66f7186

Browse files
committed
[CVP] Add pre-commit tests. NFC.
1 parent 770fd38 commit 66f7186

File tree

1 file changed

+70
-1
lines changed
  • llvm/test/Transforms/CorrelatedValuePropagation

1 file changed

+70
-1
lines changed

llvm/test/Transforms/CorrelatedValuePropagation/min-max.ll

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s
2+
; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s --check-prefixes=CHECK,CHECK-CANONICALIZE-ON
3+
; RUN: opt < %s -passes=correlated-propagation -canonicalize-icmp-predicates-to-unsigned=false -S | FileCheck %s --check-prefixes=CHECK,CHECK-CANONICALIZE-OFF
34

45
declare void @llvm.assume(i1)
56
declare i8 @llvm.umin(i8, i8)
@@ -290,3 +291,71 @@ if.end:
290291
%phi = phi i64 [%val, %bb1], [0, %entry]
291292
ret i64 %phi
292293
}
294+
295+
define i8 @test_smax_to_umax_nneg(i8 %a, i8 %b) {
296+
; CHECK-LABEL: @test_smax_to_umax_nneg(
297+
; CHECK-NEXT: [[NNEG_A:%.*]] = and i8 [[A:%.*]], 127
298+
; CHECK-NEXT: [[NNEG_B:%.*]] = and i8 [[B:%.*]], 127
299+
; CHECK-NEXT: [[RET:%.*]] = call i8 @llvm.smax.i8(i8 [[NNEG_A]], i8 [[NNEG_B]])
300+
; CHECK-NEXT: ret i8 [[RET]]
301+
;
302+
%nneg_a = and i8 %a, 127
303+
%nneg_b = and i8 %b, 127
304+
%ret = call i8 @llvm.smax.i8(i8 %nneg_a, i8 %nneg_b)
305+
ret i8 %ret
306+
}
307+
308+
define i8 @test_smax_to_umax_neg(i8 %a, i8 %b) {
309+
; CHECK-LABEL: @test_smax_to_umax_neg(
310+
; CHECK-NEXT: [[NEG_A:%.*]] = or i8 [[A:%.*]], -128
311+
; CHECK-NEXT: [[NEG_B:%.*]] = or i8 [[B:%.*]], -128
312+
; CHECK-NEXT: [[RET:%.*]] = call i8 @llvm.smax.i8(i8 [[NEG_A]], i8 [[NEG_B]])
313+
; CHECK-NEXT: ret i8 [[RET]]
314+
;
315+
%neg_a = or i8 %a, 128
316+
%neg_b = or i8 %b, 128
317+
%ret = call i8 @llvm.smax.i8(i8 %neg_a, i8 %neg_b)
318+
ret i8 %ret
319+
}
320+
321+
define i8 @test_smin_to_umin_nneg(i8 %a, i8 %b) {
322+
; CHECK-LABEL: @test_smin_to_umin_nneg(
323+
; CHECK-NEXT: [[NNEG_A:%.*]] = and i8 [[A:%.*]], 127
324+
; CHECK-NEXT: [[NNEG_B:%.*]] = and i8 [[B:%.*]], 127
325+
; CHECK-NEXT: [[RET:%.*]] = call i8 @llvm.smin.i8(i8 [[NNEG_A]], i8 [[NNEG_B]])
326+
; CHECK-NEXT: ret i8 [[RET]]
327+
;
328+
%nneg_a = and i8 %a, 127
329+
%nneg_b = and i8 %b, 127
330+
%ret = call i8 @llvm.smin.i8(i8 %nneg_a, i8 %nneg_b)
331+
ret i8 %ret
332+
}
333+
334+
define i8 @test_smin_to_umin_neg(i8 %a, i8 %b) {
335+
; CHECK-LABEL: @test_smin_to_umin_neg(
336+
; CHECK-NEXT: [[NEG_A:%.*]] = or i8 [[A:%.*]], -128
337+
; CHECK-NEXT: [[NEG_B:%.*]] = or i8 [[B:%.*]], -128
338+
; CHECK-NEXT: [[RET:%.*]] = call i8 @llvm.smin.i8(i8 [[NEG_A]], i8 [[NEG_B]])
339+
; CHECK-NEXT: ret i8 [[RET]]
340+
;
341+
%neg_a = or i8 %a, 128
342+
%neg_b = or i8 %b, 128
343+
%ret = call i8 @llvm.smin.i8(i8 %neg_a, i8 %neg_b)
344+
ret i8 %ret
345+
}
346+
347+
define i8 @test_umax_nneg(i8 %a, i8 %b) {
348+
; CHECK-LABEL: @test_umax_nneg(
349+
; CHECK-NEXT: [[NNEG_A:%.*]] = and i8 [[A:%.*]], 127
350+
; CHECK-NEXT: [[NNEG_B:%.*]] = and i8 [[B:%.*]], 127
351+
; CHECK-NEXT: [[RET:%.*]] = call i8 @llvm.umax.i8(i8 [[NNEG_A]], i8 [[NNEG_B]])
352+
; CHECK-NEXT: ret i8 [[RET]]
353+
;
354+
%nneg_a = and i8 %a, 127
355+
%nneg_b = and i8 %b, 127
356+
%ret = call i8 @llvm.umax.i8(i8 %nneg_a, i8 %nneg_b)
357+
ret i8 %ret
358+
}
359+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
360+
; CHECK-CANONICALIZE-OFF: {{.*}}
361+
; CHECK-CANONICALIZE-ON: {{.*}}

0 commit comments

Comments
 (0)