Test Failure: Transforms/InstCombine/saturating-add-sub.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
define i8 @test_scalar_uadd_canonical(i8 %a) {
%0:
  %x = uadd_sat i8 10, %a
  ret i8 %x
}
=>
define i8 @test_scalar_uadd_canonical(i8 %a) {
%0:
  %x = uadd_sat i8 %a, 10
  ret i8 %x
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_canonical(<2 x i8> %a) {
%0:
  %x = uadd_sat <2 x i8> { 10, 20 }, %a
  ret <2 x i8> %x
}
=>
define <2 x i8> @test_vector_uadd_canonical(<2 x i8> %a) {
%0:
  %x = uadd_sat <2 x i8> %a, { 10, 20 }
  ret <2 x i8> %x
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_canonical(i8 %a) {
%0:
  %x = sadd_sat i8 246, %a
  ret i8 %x
}
=>
define i8 @test_scalar_sadd_canonical(i8 %a) {
%0:
  %x = sadd_sat i8 %a, 246
  ret i8 %x
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_canonical(<2 x i8> %a) {
%0:
  %x = sadd_sat <2 x i8> { 10, 236 }, %a
  ret <2 x i8> %x
}
=>
define <2 x i8> @test_vector_sadd_canonical(<2 x i8> %a) {
%0:
  %x = sadd_sat <2 x i8> %a, { 10, 236 }
  ret <2 x i8> %x
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_combine(i8 %a) {
%0:
  %x1 = uadd_sat i8 %a, 10
  %x2 = uadd_sat i8 %x1, 20
  ret i8 %x2
}
=>
define i8 @test_scalar_uadd_combine(i8 %a) {
%0:
  %1 = uadd_sat i8 %a, 30
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_combine(<2 x i8> %a) {
%0:
  %x1 = uadd_sat <2 x i8> %a, { 10, 10 }
  %x2 = uadd_sat <2 x i8> %x1, { 20, 20 }
  ret <2 x i8> %x2
}
=>
define <2 x i8> @test_vector_uadd_combine(<2 x i8> %a) {
%0:
  %1 = uadd_sat <2 x i8> %a, { 30, 30 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_combine_non_splat(<2 x i8> %a) {
%0:
  %x1 = uadd_sat <2 x i8> %a, { 10, 20 }
  %x2 = uadd_sat <2 x i8> %x1, { 30, 40 }
  ret <2 x i8> %x2
}
=>
define <2 x i8> @test_vector_uadd_combine_non_splat(<2 x i8> %a) {
%0:
  %x1 = uadd_sat <2 x i8> %a, { 10, 20 }
  %x2 = uadd_sat <2 x i8> %x1, { 30, 40 }
  ret <2 x i8> %x2
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_overflow(i8 %a) {
%0:
  %y1 = uadd_sat i8 %a, 100
  %y2 = uadd_sat i8 %y1, 200
  ret i8 %y2
}
=>
define i8 @test_scalar_uadd_overflow(i8 %a) {
%0:
  ret i8 255
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_overflow(<2 x i8> %a) {
%0:
  %y1 = uadd_sat <2 x i8> %a, { 100, 100 }
  %y2 = uadd_sat <2 x i8> %y1, { 200, 200 }
  ret <2 x i8> %y2
}
=>
define <2 x i8> @test_vector_uadd_overflow(<2 x i8> %a) {
%0:
  ret <2 x i8> { 255, 255 }
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_both_positive(i8 %a) {
%0:
  %z1 = sadd_sat i8 %a, 10
  %z2 = sadd_sat i8 %z1, 20
  ret i8 %z2
}
=>
define i8 @test_scalar_sadd_both_positive(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 30
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_both_positive(<2 x i8> %a) {
%0:
  %z1 = sadd_sat <2 x i8> %a, { 10, 10 }
  %z2 = sadd_sat <2 x i8> %z1, { 20, 20 }
  ret <2 x i8> %z2
}
=>
define <2 x i8> @test_vector_sadd_both_positive(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 30, 30 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_both_negative(i8 %a) {
%0:
  %u1 = sadd_sat i8 %a, 246
  %u2 = sadd_sat i8 %u1, 236
  ret i8 %u2
}
=>
define i8 @test_scalar_sadd_both_negative(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 226
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_both_negative(<2 x i8> %a) {
%0:
  %u1 = sadd_sat <2 x i8> %a, { 246, 246 }
  %u2 = sadd_sat <2 x i8> %u1, { 236, 236 }
  ret <2 x i8> %u2
}
=>
define <2 x i8> @test_vector_sadd_both_negative(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 226, 226 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_different_sign(i8 %a) {
%0:
  %v1 = sadd_sat i8 %a, 10
  %v2 = sadd_sat i8 %v1, 236
  ret i8 %v2
}
=>
define i8 @test_scalar_sadd_different_sign(i8 %a) {
%0:
  %v1 = sadd_sat i8 %a, 10
  %v2 = sadd_sat i8 %v1, 236
  ret i8 %v2
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_overflow(i8 %a) {
%0:
  %w1 = sadd_sat i8 %a, 100
  %w2 = sadd_sat i8 %w1, 100
  ret i8 %w2
}
=>
define i8 @test_scalar_sadd_overflow(i8 %a) {
%0:
  %w1 = sadd_sat i8 %a, 100
  %w2 = sadd_sat i8 %w1, 100
  ret i8 %w2
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_neg_neg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = uadd_sat i8 %a_neg, 246
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_neg_neg(i8 %a) {
%0:
  ret i8 255
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_neg_neg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = uadd_sat <2 x i8> %a_neg, { 246, 236 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_uadd_neg_neg(<2 x i8> %a) {
%0:
  ret <2 x i8> { 255, 255 }
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_nneg_nneg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = uadd_sat i8 %a_nneg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_nneg_nneg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = add nuw i8 %a_nneg, 10
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_nneg_nneg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = uadd_sat <2 x i8> %a_nneg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_uadd_nneg_nneg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = add nuw <2 x i8> %a_nneg, { 10, 20 }
  ret <2 x i8> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_uadd_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = uadd_sat i8 %a_neg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = uadd_sat i8 %a_neg, 10
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = uadd_sat <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_uadd_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = uadd_sat <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_uadd_never_overflows(i8 %a) {
%0:
  %a_masked = and i8 %a, 129
  %r = uadd_sat i8 %a_masked, 1
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_never_overflows(i8 %a) {
%0:
  %a_masked = and i8 %a, 129
  %r = add nsw nuw i8 %a_masked, 1
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_never_overflows(<2 x i8> %a) {
%0:
  %a_masked = and <2 x i8> %a, { 129, 129 }
  %r = uadd_sat <2 x i8> %a_masked, { 1, 1 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_uadd_never_overflows(<2 x i8> %a) {
%0:
  %a_masked = and <2 x i8> %a, { 129, 129 }
  %r = add nsw nuw <2 x i8> %a_masked, { 1, 1 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_always_overflows(i8 %a) {
%0:
  %a_masked = or i8 %a, 192
  %r = uadd_sat i8 %a_masked, 64
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_always_overflows(i8 %a) {
%0:
  ret i8 255
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_uadd_always_overflows(<2 x i8> %a) {
%0:
  %a_masked = or <2 x i8> %a, { 192, 192 }
  %r = uadd_sat <2 x i8> %a_masked, { 64, 64 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_uadd_always_overflows(<2 x i8> %a) {
%0:
  ret <2 x i8> { 255, 255 }
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = sadd_sat i8 %a_neg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = add nsw i8 %a_neg, 10
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = sadd_sat <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_sadd_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = add nsw <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_sadd_nneg_neg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = sadd_sat i8 %a_nneg, 246
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_nneg_neg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = add nsw i8 %a_nneg, 246
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_nneg_neg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = sadd_sat <2 x i8> %a_nneg, { 246, 236 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_sadd_nneg_neg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = add nsw <2 x i8> %a_nneg, { 246, 236 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_neg_neg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = sadd_sat i8 %a_neg, 246
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_neg_neg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = sadd_sat i8 %a_neg, 246
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_neg_neg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = sadd_sat <2 x i8> %a_neg, { 246, 236 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_sadd_neg_neg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = sadd_sat <2 x i8> %a_neg, { 246, 236 }
  ret <2 x i8> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_sadd_always_overflows_low(i8 %a) {
%0:
  %cmp = icmp slt i8 %a, 136
  %min = select i1 %cmp, i8 %a, i8 136
  %r = sadd_sat i8 %min, 246
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_always_overflows_low(i8 %a) {
%0:
  ret i8 128
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_always_overflows_high(i8 %a) {
%0:
  %cmp = icmp sgt i8 %a, 120
  %max = select i1 %cmp, i8 %a, i8 120
  %r = sadd_sat i8 %max, 10
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_always_overflows_high(i8 %a) {
%0:
  ret i8 127
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_sub_nuw_lost_no_ov(i8 %a) {
%0:
  %b = sub nuw i8 %a, 10
  %r = uadd_sat i8 %b, 9
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_sub_nuw_lost_no_ov(i8 %a) {
%0:
  %b = add i8 %a, 246
  %r = uadd_sat i8 %b, 9
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_urem_no_ov(i8 %a) {
%0:
  %b = urem i8 %a, 100
  %r = uadd_sat i8 %b, 156
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_urem_no_ov(i8 %a) {
%0:
  %b = urem i8 %a, 100
  %r = add nsw nuw i8 %b, 156
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_urem_may_ov(i8 %a) {
%0:
  %b = urem i8 %a, 100
  %r = uadd_sat i8 %b, 157
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_urem_may_ov(i8 %a) {
%0:
  %b = urem i8 %a, 100
  %r = uadd_sat i8 %b, 157
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_udiv_known_bits(i8 %a, i8 %b) {
%0:
  %aa = udiv i8 190, %a
  %bb = and i8 %b, 63
  %r = uadd_sat i8 %aa, %bb
  ret i8 %r
}
=>
define i8 @test_scalar_uadd_udiv_known_bits(i8 %a, i8 %b) {
%0:
  %aa = udiv i8 190, %a
  %bb = and i8 %b, 63
  %r = add nuw i8 %aa, %bb
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_srem_no_ov(i8 %a) {
%0:
  %b = srem i8 %a, 100
  %r = sadd_sat i8 %b, 28
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_srem_no_ov(i8 %a) {
%0:
  %b = srem i8 %a, 100
  %r = add nsw i8 %b, 28
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_srem_may_ov(i8 %a) {
%0:
  %b = srem i8 %a, 100
  %r = sadd_sat i8 %b, 29
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_srem_may_ov(i8 %a) {
%0:
  %b = srem i8 %a, 100
  %r = sadd_sat i8 %b, 29
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_srem_and_no_ov(i8 %a, i8 %b) {
%0:
  %aa = srem i8 %a, 100
  %bb = and i8 %b, 15
  %r = sadd_sat i8 %aa, %bb
  ret i8 %r
}
=>
define i8 @test_scalar_sadd_srem_and_no_ov(i8 %a, i8 %b) {
%0:
  %aa = srem i8 %a, 100
  %bb = and i8 %b, 15
  %r = add nsw i8 %aa, %bb
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_canonical(i8 %a) {
%0:
  %r = usub_sat i8 %a, 10
  ret i8 %r
}
=>
define i8 @test_scalar_usub_canonical(i8 %a) {
%0:
  %r = usub_sat i8 %a, 10
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_canonical(i8 %a) {
%0:
  %r = ssub_sat i8 %a, 10
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_canonical(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 246
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_canonical(<2 x i8> %a) {
%0:
  %r = ssub_sat <2 x i8> %a, { 10, 10 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_canonical(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 246, 246 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_canonical_min_non_splat(<2 x i8> %a) {
%0:
  %r = ssub_sat <2 x i8> %a, { 10, 246 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_canonical_min_non_splat(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 246, 10 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_canonical_min(i8 %a) {
%0:
  %r = ssub_sat i8 %a, 128
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_canonical_min(i8 %a) {
%0:
  %r = ssub_sat i8 %a, 128
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_canonical_min(<2 x i8> %a) {
%0:
  %r = ssub_sat <2 x i8> %a, { 128, 246 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_canonical_min(<2 x i8> %a) {
%0:
  %r = ssub_sat <2 x i8> %a, { 128, 246 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_combine(i8 %a) {
%0:
  %x1 = usub_sat i8 %a, 10
  %x2 = usub_sat i8 %x1, 20
  ret i8 %x2
}
=>
define i8 @test_scalar_usub_combine(i8 %a) {
%0:
  %1 = usub_sat i8 %a, 30
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_combine(<2 x i8> %a) {
%0:
  %x1 = usub_sat <2 x i8> %a, { 10, 10 }
  %x2 = usub_sat <2 x i8> %x1, { 20, 20 }
  ret <2 x i8> %x2
}
=>
define <2 x i8> @test_vector_usub_combine(<2 x i8> %a) {
%0:
  %1 = usub_sat <2 x i8> %a, { 30, 30 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_combine_non_splat(<2 x i8> %a) {
%0:
  %x1 = usub_sat <2 x i8> %a, { 10, 20 }
  %x2 = usub_sat <2 x i8> %x1, { 30, 40 }
  ret <2 x i8> %x2
}
=>
define <2 x i8> @test_vector_usub_combine_non_splat(<2 x i8> %a) {
%0:
  %x1 = usub_sat <2 x i8> %a, { 10, 20 }
  %x2 = usub_sat <2 x i8> %x1, { 30, 40 }
  ret <2 x i8> %x2
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_overflow(i8 %a) {
%0:
  %y1 = usub_sat i8 %a, 100
  %y2 = usub_sat i8 %y1, 200
  ret i8 %y2
}
=>
define i8 @test_scalar_usub_overflow(i8 %a) {
%0:
  ret i8 0
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_overflow(<2 x i8> %a) {
%0:
  %y1 = usub_sat <2 x i8> %a, { 100, 100 }
  %y2 = usub_sat <2 x i8> %y1, { 200, 200 }
  ret <2 x i8> %y2
}
=>
define <2 x i8> @test_vector_usub_overflow(<2 x i8> %a) {
%0:
  ret <2 x i8> { 0, 0 }
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_both_positive(i8 %a) {
%0:
  %z1 = ssub_sat i8 %a, 10
  %z2 = ssub_sat i8 %z1, 20
  ret i8 %z2
}
=>
define i8 @test_scalar_ssub_both_positive(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 226
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_both_positive(<2 x i8> %a) {
%0:
  %z1 = ssub_sat <2 x i8> %a, { 10, 10 }
  %z2 = ssub_sat <2 x i8> %z1, { 20, 20 }
  ret <2 x i8> %z2
}
=>
define <2 x i8> @test_vector_ssub_both_positive(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 226, 226 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_both_negative(i8 %a) {
%0:
  %u1 = ssub_sat i8 %a, 246
  %u2 = ssub_sat i8 %u1, 236
  ret i8 %u2
}
=>
define i8 @test_scalar_ssub_both_negative(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 30
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_both_negative(<2 x i8> %a) {
%0:
  %u1 = ssub_sat <2 x i8> %a, { 246, 246 }
  %u2 = ssub_sat <2 x i8> %u1, { 236, 236 }
  ret <2 x i8> %u2
}
=>
define <2 x i8> @test_vector_ssub_both_negative(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 30, 30 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_different_sign(i8 %a) {
%0:
  %v1 = ssub_sat i8 %a, 10
  %v2 = ssub_sat i8 %v1, 236
  ret i8 %v2
}
=>
define i8 @test_scalar_ssub_different_sign(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 246
  %2 = sadd_sat i8 %1, 20
  ret i8 %2
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_sadd_ssub(i8 %a) {
%0:
  %v1 = sadd_sat i8 10, %a
  %v2 = ssub_sat i8 %v1, 236
  ret i8 %v2
}
=>
define i8 @test_scalar_sadd_ssub(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 30
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_sadd_ssub(<2 x i8> %a) {
%0:
  %v1 = sadd_sat <2 x i8> { 246, 246 }, %a
  %v2 = ssub_sat <2 x i8> %v1, { 20, 20 }
  ret <2 x i8> %v2
}
=>
define <2 x i8> @test_vector_sadd_ssub(<2 x i8> %a) {
%0:
  %1 = sadd_sat <2 x i8> %a, { 226, 226 }
  ret <2 x i8> %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_overflow(i8 %a) {
%0:
  %w1 = ssub_sat i8 %a, 100
  %w2 = ssub_sat i8 %w1, 100
  ret i8 %w2
}
=>
define i8 @test_scalar_ssub_overflow(i8 %a) {
%0:
  %1 = sadd_sat i8 %a, 156
  %2 = sadd_sat i8 %1, 156
  ret i8 %2
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_nneg_neg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = usub_sat i8 %a_nneg, 246
  ret i8 %r
}
=>
define i8 @test_scalar_usub_nneg_neg(i8 %a) {
%0:
  ret i8 0
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_nneg_neg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = usub_sat <2 x i8> %a_nneg, { 246, 236 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_nneg_neg(<2 x i8> %a) {
%0:
  ret <2 x i8> { 0, 0 }
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = usub_sat i8 %a_neg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_usub_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = add i8 %a_neg, 246
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = usub_sat <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = add <2 x i8> %a_neg, { 246, 236 }
  ret <2 x i8> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_usub_nneg_nneg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = usub_sat i8 %a_nneg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_usub_nneg_nneg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = usub_sat i8 %a_nneg, 10
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_nneg_nneg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = usub_sat <2 x i8> %a_nneg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_nneg_nneg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = usub_sat <2 x i8> %a_nneg, { 10, 20 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_never_overflows(i8 %a) {
%0:
  %a_masked = or i8 %a, 64
  %r = usub_sat i8 %a_masked, 10
  ret i8 %r
}
=>
define i8 @test_scalar_usub_never_overflows(i8 %a) {
%0:
  %a_masked = or i8 %a, 64
  %r = add nsw i8 %a_masked, 246
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_never_overflows(<2 x i8> %a) {
%0:
  %a_masked = or <2 x i8> %a, { 64, 64 }
  %r = usub_sat <2 x i8> %a_masked, { 10, 10 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_never_overflows(<2 x i8> %a) {
%0:
  %a_masked = or <2 x i8> %a, { 64, 64 }
  %r = add nsw <2 x i8> %a_masked, { 246, 246 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_always_overflows(i8 %a) {
%0:
  %a_masked = and i8 %a, 64
  %r = usub_sat i8 %a_masked, 100
  ret i8 %r
}
=>
define i8 @test_scalar_usub_always_overflows(i8 %a) {
%0:
  ret i8 0
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_always_overflows(<2 x i8> %a) {
%0:
  %a_masked = and <2 x i8> %a, { 64, 64 }
  %r = usub_sat <2 x i8> %a_masked, { 100, 100 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_always_overflows(<2 x i8> %a) {
%0:
  ret <2 x i8> { 0, 0 }
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_neg_neg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = ssub_sat i8 %a_neg, 246
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_neg_neg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = add nsw i8 %a_neg, 10
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_neg_neg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = ssub_sat <2 x i8> %a_neg, { 246, 236 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_neg_neg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = add nsw <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_ssub_nneg_nneg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = ssub_sat i8 %a_nneg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_nneg_nneg(i8 %a) {
%0:
  %a_nneg = and i8 %a, 127
  %r = add nsw i8 %a_nneg, 246
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_nneg_nneg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = ssub_sat <2 x i8> %a_nneg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_nneg_nneg(<2 x i8> %a) {
%0:
  %a_nneg = and <2 x i8> %a, { 127, 127 }
  %r = add nsw <2 x i8> %a_nneg, { 246, 236 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %r = ssub_sat i8 %a_neg, 10
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_neg_nneg(i8 %a) {
%0:
  %a_neg = or i8 %a, 128
  %1 = sadd_sat i8 %a_neg, 246
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %r = ssub_sat <2 x i8> %a_neg, { 10, 20 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_neg_nneg(<2 x i8> %a) {
%0:
  %a_neg = or <2 x i8> %a, { 128, 128 }
  %1 = sadd_sat <2 x i8> %a_neg, { 246, 236 }
  ret <2 x i8> %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_ssub_always_overflows_low(i8 %a) {
%0:
  %cmp = icmp sgt i8 %a, 120
  %max = select i1 %cmp, i8 %a, i8 120
  %r = ssub_sat i8 246, %max
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_always_overflows_low(i8 %a) {
%0:
  ret i8 128
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_always_overflows_high(i8 %a) {
%0:
  %cmp = icmp slt i8 %a, 136
  %min = select i1 %cmp, i8 %a, i8 136
  %r = ssub_sat i8 10, %min
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_always_overflows_high(i8 %a) {
%0:
  ret i8 127
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_nuw_no_ov(i8 %a) {
%0:
  %b = add nuw i8 %a, 10
  %r = usub_sat i8 %b, 9
  ret i8 %r
}
=>
define i8 @test_scalar_usub_add_nuw_no_ov(i8 %a) {
%0:
  %r = add i8 %a, 1
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_nuw_eq(i8 %a) {
%0:
  %b = add nuw i8 %a, 10
  %r = usub_sat i8 %b, 10
  ret i8 %r
}
=>
define i8 @test_scalar_usub_add_nuw_eq(i8 %a) {
%0:
  ret i8 %a
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_nuw_may_ov(i8 %a) {
%0:
  %b = add nuw i8 %a, 10
  %r = usub_sat i8 %b, 11
  ret i8 %r
}
=>
define i8 @test_scalar_usub_add_nuw_may_ov(i8 %a) {
%0:
  %b = add nuw i8 %a, 10
  %r = usub_sat i8 %b, 11
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_urem_must_ov(i8 %a) {
%0:
  %b = urem i8 %a, 10
  %r = usub_sat i8 %b, 10
  ret i8 %r
}
=>
define i8 @test_scalar_usub_urem_must_ov(i8 %a) {
%0:
  ret i8 0
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_urem_must_zero(i8 %a) {
%0:
  %b = urem i8 %a, 10
  %r = usub_sat i8 %b, 9
  ret i8 %r
}
=>
define i8 @test_scalar_usub_urem_must_zero(i8 %a) {
%0:
  %b = urem i8 %a, 10
  %r = usub_sat i8 %b, 9
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_nuw_known_bits(i8 %a, i8 %b) {
%0:
  %aa = add nuw i8 %a, 10
  %bb = and i8 %b, 7
  %r = usub_sat i8 %aa, %bb
  ret i8 %r
}
=>
define i8 @test_scalar_usub_add_nuw_known_bits(i8 %a, i8 %b) {
%0:
  %aa = add nuw i8 %a, 10
  %bb = and i8 %b, 7
  %r = sub nuw i8 %aa, %bb
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_nuw_inferred(i8 %a) {
%0:
  %b = usub_sat i8 %a, 10
  %r = add i8 %b, 9
  ret i8 %r
}
=>
define i8 @test_scalar_usub_add_nuw_inferred(i8 %a) {
%0:
  %b = usub_sat i8 %a, 10
  %r = add nuw i8 %b, 9
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_add_nuw_no_ov(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 10 }
  %r = usub_sat <2 x i8> %b, { 9, 9 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_add_nuw_no_ov(<2 x i8> %a) {
%0:
  %r = add <2 x i8> %a, { 1, 1 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat1(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 10 }
  %r = usub_sat <2 x i8> %b, { 10, 9 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat1(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 10 }
  %r = usub_sat <2 x i8> %b, { 10, 9 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat2(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 9 }
  %r = usub_sat <2 x i8> %b, { 9, 9 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat2(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 9 }
  %r = usub_sat <2 x i8> %b, { 9, 9 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat3(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 9 }
  %r = usub_sat <2 x i8> %b, { 10, 9 }
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat3(<2 x i8> %a) {
%0:
  %b = add nuw <2 x i8> %a, { 10, 9 }
  %r = usub_sat <2 x i8> %b, { 10, 9 }
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_add_nsw_no_ov(i8 %a, i8 %b) {
%0:
  %aa = add nsw i8 %a, 7
  %bb = and i8 %b, 7
  %r = ssub_sat i8 %aa, %bb
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_add_nsw_no_ov(i8 %a, i8 %b) {
%0:
  %aa = add nsw i8 %a, 7
  %bb = and i8 %b, 7
  %r = sub nsw i8 %aa, %bb
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_ssub_add_nsw_may_ov(i8 %a, i8 %b) {
%0:
  %aa = add nsw i8 %a, 6
  %bb = and i8 %b, 7
  %r = ssub_sat i8 %aa, %bb
  ret i8 %r
}
=>
define i8 @test_scalar_ssub_add_nsw_may_ov(i8 %a, i8 %b) {
%0:
  %aa = add nsw i8 %a, 6
  %bb = and i8 %b, 7
  %r = ssub_sat i8 %aa, %bb
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_splat(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 7 }
  %bb = and <2 x i8> %b, { 7, 7 }
  %r = ssub_sat <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_splat(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 7 }
  %bb = and <2 x i8> %b, { 7, 7 }
  %r = sub nsw <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_nonsplat1(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 7 }
  %bb = and <2 x i8> %b, { 7, 6 }
  %r = ssub_sat <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_nonsplat1(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 7 }
  %bb = and <2 x i8> %b, { 7, 6 }
  %r = sub nsw <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_nonsplat2(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 8 }
  %bb = and <2 x i8> %b, { 7, 7 }
  %r = ssub_sat <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_nonsplat2(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 8 }
  %bb = and <2 x i8> %b, { 7, 7 }
  %r = ssub_sat <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_nonsplat3(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 6 }
  %bb = and <2 x i8> %b, { 7, 6 }
  %r = ssub_sat <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
=>
define <2 x i8> @test_vector_ssub_add_nsw_no_ov_nonsplat3(<2 x i8> %a, <2 x i8> %b) {
%0:
  %aa = add nsw <2 x i8> %a, { 7, 6 }
  %bb = and <2 x i8> %b, { 7, 6 }
  %r = ssub_sat <2 x i8> %aa, %bb
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add(i8 %a, i8 %b) {
%0:
  %sat = usub_sat i8 %a, %b
  %res = add i8 %sat, %b
  ret i8 %res
}
=>
define i8 @test_scalar_usub_add(i8 %a, i8 %b) {
%0:
  %1 = umax i8 %a, %b
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_extra_use(i8 %a, i8 %b, * %p) {
%0:
  %sat = usub_sat i8 %a, %b
  store i8 %sat, * %p, align 1
  %res = add i8 %sat, %b
  ret i8 %res
}
=>
define i8 @test_scalar_usub_add_extra_use(i8 %a, i8 %b, * %p) {
%0:
  %sat = usub_sat i8 %a, %b
  store i8 %sat, * %p, align 1
  %res = add i8 %sat, %b
  ret i8 %res
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_usub_add_commuted(i8 %a, i8 %b) {
%0:
  %sat = usub_sat i8 %a, %b
  %res = add i8 %b, %sat
  ret i8 %res
}
=>
define i8 @test_scalar_usub_add_commuted(i8 %a, i8 %b) {
%0:
  %1 = umax i8 %a, %b
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_commuted_wrong(i8 %a, i8 %b) {
%0:
  %sat = usub_sat i8 %b, %a
  %res = add i8 %sat, %b
  ret i8 %res
}
=>
define i8 @test_scalar_usub_add_commuted_wrong(i8 %a, i8 %b) {
%0:
  %sat = usub_sat i8 %b, %a
  %res = add i8 %sat, %b
  ret i8 %res
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_usub_add_const(i8 %a) {
%0:
  %sat = usub_sat i8 %a, 42
  %res = add i8 %sat, 42
  ret i8 %res
}
=>
define i8 @test_scalar_usub_add_const(i8 %a) {
%0:
  %1 = umax i8 %a, 42
  ret i8 %1
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_sub(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %a, %b
  %res = sub i8 %sat, %b
  ret i8 %res
}
=>
define i8 @test_scalar_uadd_sub(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %a, %b
  %res = sub i8 %sat, %b
  ret i8 %res
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_uadd_sub_extra_use(i8 %a, i8 %b, * %p) {
%0:
  %sat = uadd_sat i8 %a, %b
  store i8 %sat, * %p, align 1
  %res = sub i8 %sat, %b
  ret i8 %res
}
=>
define i8 @test_scalar_uadd_sub_extra_use(i8 %a, i8 %b, * %p) {
%0:
  %sat = uadd_sat i8 %a, %b
  store i8 %sat, * %p, align 1
  %res = sub i8 %sat, %b
  ret i8 %res
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_uadd_sub_commuted(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %b, %a
  %res = sub i8 %sat, %b
  ret i8 %res
}
=>
define i8 @test_scalar_uadd_sub_commuted(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %b, %a
  %res = sub i8 %sat, %b
  ret i8 %res
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @test_scalar_uadd_sub_commuted_wrong(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %a, %b
  %res = sub i8 %b, %sat
  ret i8 %res
}
=>
define i8 @test_scalar_uadd_sub_commuted_wrong(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %a, %b
  %res = sub i8 %b, %sat
  ret i8 %res
}
Transformation seems to be correct!


----------------------------------------
define i8 @test_scalar_uadd_sub_const(i8 %a) {
%0:
  %sat = uadd_sat i8 %a, 42
  %res = sub i8 %sat, 42
  ret i8 %res
}
=>
define i8 @test_scalar_uadd_sub_const(i8 %a) {
%0:
  %sat = uadd_sat i8 %a, 42
  %res = add i8 %sat, 214
  ret i8 %res
}
Transformation seems to be correct!


----------------------------------------
define i1 @scalar_uadd_eq_zero(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %a, %b
  %cmp = icmp eq i8 %sat, 0
  ret i1 %cmp
}
=>
define i1 @scalar_uadd_eq_zero(i8 %a, i8 %b) {
%0:
  %1 = or i8 %a, %b
  %cmp = icmp eq i8 %1, 0
  ret i1 %cmp
}
Transformation seems to be correct!


----------------------------------------
define i1 @scalar_uadd_ne_zero(i8 %a, i8 %b) {
%0:
  %sat = uadd_sat i8 %a, %b
  %cmp = icmp ne i8 %sat, 0
  ret i1 %cmp
}
=>
define i1 @scalar_uadd_ne_zero(i8 %a, i8 %b) {
%0:
  %1 = or i8 %a, %b
  %cmp = icmp ne i8 %1, 0
  ret i1 %cmp
}
Transformation seems to be correct!


----------------------------------------
define i1 @scalar_usub_eq_zero(i8 %a, i8 %b) {
%0:
  %sat = usub_sat i8 %a, %b
  %cmp = icmp eq i8 %sat, 0
  ret i1 %cmp
}
=>
define i1 @scalar_usub_eq_zero(i8 %a, i8 %b) {
%0:
  %cmp = icmp ule i8 %a, %b
  ret i1 %cmp
}
Transformation seems to be correct!


----------------------------------------
define i1 @scalar_usub_ne_zero(i8 %a, i8 %b) {
%0:
  %sat = usub_sat i8 %a, %b
  %cmp = icmp ne i8 %sat, 0
  ret i1 %cmp
}
=>
define i1 @scalar_usub_ne_zero(i8 %a, i8 %b) {
%0:
  %cmp = icmp ugt i8 %a, %b
  ret i1 %cmp
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %x
  %c = icmp ult i32 %notx, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat(i32 %x, i32 %y) {
%0:
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_nonstrict(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %x
  %c = icmp ule i32 %notx, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_nonstrict(i32 %x, i32 %y) {
%0:
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_commute_add(i32 %xp, i32 %y) {
%0:
  %x = urem i32 42, %xp
  %notx = xor i32 %x, 4294967295
  %a = add i32 %x, %y
  %c = icmp ult i32 %notx, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_commute_add(i32 %xp, i32 %y) {
%0:
  %x = urem i32 42, %xp
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_ugt(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %x
  %c = icmp ugt i32 %y, %notx
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_ugt(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_uge(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %x
  %c = icmp uge i32 %y, %notx
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_uge(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @uadd_sat_ugt_commute_add(<2 x i32> %xp, <2 x i32> %yp) {
%0:
  %y = sdiv <2 x i32> %yp, { 2442, 4242 }
  %x = srem <2 x i32> { 42, 43 }, %xp
  %notx = xor <2 x i32> %x, { 4294967295, 4294967295 }
  %a = add <2 x i32> %x, %y
  %c = icmp ugt <2 x i32> %y, %notx
  %r = select <2 x i1> %c, <2 x i32> { 4294967295, 4294967295 }, <2 x i32> %a
  ret <2 x i32> %r
}
=>
define <2 x i32> @uadd_sat_ugt_commute_add(<2 x i32> %xp, <2 x i32> %yp) {
%0:
  %y = sdiv <2 x i32> %yp, { 2442, 4242 }
  %x = srem <2 x i32> { 42, 43 }, %xp
  %1 = uadd_sat <2 x i32> %x, %y
  ret <2 x i32> %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_commute_select(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %x
  %c = icmp ult i32 %y, %notx
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_commute_select(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_commute_select_nonstrict(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %x
  %c = icmp ule i32 %y, %notx
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_commute_select_nonstrict(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 %yp, 2442
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_commute_select_commute_add(i32 %xp, i32 %yp) {
%0:
  %x = urem i32 42, %xp
  %y = sdiv i32 %yp, 2442
  %notx = xor i32 %x, 4294967295
  %a = add i32 %x, %y
  %c = icmp ult i32 %y, %notx
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_commute_select_commute_add(i32 %xp, i32 %yp) {
%0:
  %x = urem i32 42, %xp
  %y = sdiv i32 %yp, 2442
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @uadd_sat_commute_select_ugt(<2 x i32> %x, <2 x i32> %y) {
%0:
  %notx = xor <2 x i32> %x, { 4294967295, 4294967295 }
  %a = add <2 x i32> %y, %x
  %c = icmp ugt <2 x i32> %notx, %y
  %r = select <2 x i1> %c, <2 x i32> %a, <2 x i32> { 4294967295, 4294967295 }
  ret <2 x i32> %r
}
=>
define <2 x i32> @uadd_sat_commute_select_ugt(<2 x i32> %x, <2 x i32> %y) {
%0:
  %1 = uadd_sat <2 x i32> %x, %y
  ret <2 x i32> %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_commute_select_ugt_commute_add(i32 %xp, i32 %y) {
%0:
  %x = srem i32 42, %xp
  %notx = xor i32 %x, 4294967295
  %a = add i32 %x, %y
  %c = icmp ugt i32 %notx, %y
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_commute_select_ugt_commute_add(i32 %xp, i32 %y) {
%0:
  %x = srem i32 42, %xp
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @not_uadd_sat(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, 4294967294
  %c = icmp ugt i32 %x, 1
  %r = select i1 %c, i32 %a, i32 %y
  ret i32 %r
}
=>
define i32 @not_uadd_sat(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, 4294967294
  %c = icmp ugt i32 %x, 1
  %r = select i1 %c, i32 %a, i32 %y
  ret i32 %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @not_uadd_sat2(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, 4294967294
  %c = icmp ugt i32 %x, 1
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @not_uadd_sat2(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, 4294967294
  %c = icmp ugt i32 %x, 1
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp ult i32 %x, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_not(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_nonstrict(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp ule i32 %x, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_not_nonstrict(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_commute_add(i32 %xp, i32 %yp) {
%0:
  %x = srem i32 42, %xp
  %y = urem i32 42, %yp
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %notx
  %c = icmp ult i32 %x, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_not_commute_add(i32 %xp, i32 %yp) {
%0:
  %x = srem i32 42, %xp
  %y = urem i32 42, %yp
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %y, %notx
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_not_ugt(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp ugt i32 %y, %x
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_not_ugt(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_uge(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp uge i32 %y, %x
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_not_uge(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i32> @uadd_sat_not_ugt_commute_add(<2 x i32> %x, <2 x i32> %yp) {
%0:
  %y = sdiv <2 x i32> %yp, { 2442, 4242 }
  %notx = xor <2 x i32> %x, { 4294967295, 4294967295 }
  %a = add <2 x i32> %y, %notx
  %c = icmp ugt <2 x i32> %y, %x
  %r = select <2 x i1> %c, <2 x i32> { 4294967295, 4294967295 }, <2 x i32> %a
  ret <2 x i32> %r
}
=>
define <2 x i32> @uadd_sat_not_ugt_commute_add(<2 x i32> %x, <2 x i32> %yp) {
%0:
  %y = sdiv <2 x i32> %yp, { 2442, 4242 }
  %notx = xor <2 x i32> %x, { 4294967295, 4294967295 }
  %1 = uadd_sat <2 x i32> %y, %notx
  ret <2 x i32> %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_commute_select(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp ult i32 %y, %x
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_not_commute_select(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_commute_select_nonstrict(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp ule i32 %y, %x
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_not_commute_select_nonstrict(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_commute_select_commute_add(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 42, %yp
  %notx = xor i32 %x, 4294967295
  %a = add i32 %y, %notx
  %c = icmp ult i32 %y, %x
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_not_commute_select_commute_add(i32 %x, i32 %yp) {
%0:
  %y = sdiv i32 42, %yp
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %y, %notx
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @uadd_sat_not_commute_select_ugt(<2 x i32> %xp, <2 x i32> %yp) {
%0:
  %x = urem <2 x i32> { 42, 4294967254 }, %xp
  %y = srem <2 x i32> { 12, 412 }, %yp
  %notx = xor <2 x i32> %x, { 4294967295, 4294967295 }
  %a = add <2 x i32> %y, %notx
  %c = icmp ugt <2 x i32> %x, %y
  %r = select <2 x i1> %c, <2 x i32> %a, <2 x i32> { 4294967295, 4294967295 }
  ret <2 x i32> %r
}
=>
define <2 x i32> @uadd_sat_not_commute_select_ugt(<2 x i32> %xp, <2 x i32> %yp) {
%0:
  %x = urem <2 x i32> { 42, 4294967254 }, %xp
  %y = srem <2 x i32> { 12, 412 }, %yp
  %notx = xor <2 x i32> %x, { 4294967295, 4294967295 }
  %1 = uadd_sat <2 x i32> %y, %notx
  ret <2 x i32> %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_not_commute_select_ugt_commute_add(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp ugt i32 %x, %y
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_not_commute_select_ugt_commute_add(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_not_commute_select_uge_commute_add(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %a = add i32 %notx, %y
  %c = icmp uge i32 %x, %y
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_not_commute_select_uge_commute_add(i32 %x, i32 %y) {
%0:
  %notx = xor i32 %x, 4294967295
  %1 = uadd_sat i32 %notx, %y
  ret i32 %1
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_constant(i32 %x) {
%0:
  %a = add i32 %x, 42
  %c = icmp ugt i32 %x, 4294967253
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_constant(i32 %x) {
%0:
  %a = add i32 %x, 42
  %c = icmp ugt i32 %x, 4294967253
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @uadd_sat_constant_commute(i32 %x) {
%0:
  %a = add i32 %x, 42
  %c = icmp ult i32 %x, 4294967253
  %r = select i1 %c, i32 %a, i32 4294967295
  ret i32 %r
}
=>
define i32 @uadd_sat_constant_commute(i32 %x) {
%0:
  %1 = uadd_sat i32 %x, 42
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_canon(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, %y
  %c = icmp ult i32 %a, %x
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_canon(i32 %x, i32 %y) {
%0:
  %1 = uadd_sat i32 %x, %y
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_canon_y(i32 %x, i32 %y) {
%0:
  %a = add i32 %x, %y
  %c = icmp ult i32 %a, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_canon_y(i32 %x, i32 %y) {
%0:
  %1 = uadd_sat i32 %y, %x
  ret i32 %1
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_canon_nuw(i32 %x, i32 %y) {
%0:
  %a = add nuw i32 %x, %y
  %c = icmp ult i32 %a, %x
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_canon_nuw(i32 %x, i32 %y) {
%0:
  %a = add nuw i32 %x, %y
  ret i32 %a
}
Transformation seems to be correct!


----------------------------------------
define i32 @uadd_sat_canon_y_nuw(i32 %x, i32 %y) {
%0:
  %a = add nuw i32 %x, %y
  %c = icmp ult i32 %a, %y
  %r = select i1 %c, i32 4294967295, i32 %a
  ret i32 %r
}
=>
define i32 @uadd_sat_canon_y_nuw(i32 %x, i32 %y) {
%0:
  %a = add nuw i32 %x, %y
  ret i32 %a
}
Transformation seems to be correct!


----------------------------------------
define <4 x i32> @uadd_sat_constant_vec(<4 x i32> %x) {
%0:
  %a = add <4 x i32> %x, { 42, 42, 42, 42 }
  %c = icmp ugt <4 x i32> %x, { 4294967253, 4294967253, 4294967253, 4294967253 }
  %r = select <4 x i1> %c, <4 x i32> { 4294967295, 4294967295, 4294967295, 4294967295 }, <4 x i32> %a
  ret <4 x i32> %r
}
=>
define <4 x i32> @uadd_sat_constant_vec(<4 x i32> %x) {
%0:
  %a = add <4 x i32> %x, { 42, 42, 42, 42 }
  %c = icmp ugt <4 x i32> %x, { 4294967253, 4294967253, 4294967253, 4294967253 }
  %r = select <4 x i1> %c, <4 x i32> { 4294967295, 4294967295, 4294967295, 4294967295 }, <4 x i32> %a
  ret <4 x i32> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <4 x i32> @uadd_sat_constant_vec_commute(<4 x i32> %x) {
%0:
  %a = add <4 x i32> %x, { 42, 42, 42, 42 }
  %c = icmp ult <4 x i32> %x, { 4294967253, 4294967253, 4294967253, 4294967253 }
  %r = select <4 x i1> %c, <4 x i32> %a, <4 x i32> { 4294967295, 4294967295, 4294967295, 4294967295 }
  ret <4 x i32> %r
}
=>
define <4 x i32> @uadd_sat_constant_vec_commute(<4 x i32> %x) {
%0:
  %1 = uadd_sat <4 x i32> %x, { 42, 42, 42, 42 }
  ret <4 x i32> %1
}
Transformation seems to be correct!


----------------------------------------
define <4 x i32> @uadd_sat_constant_vec_commute_undefs(<4 x i32> %x) {
%0:
  %a = add <4 x i32> %x, { 42, 42, 42, undef }
  %c = icmp ult <4 x i32> %x, { 4294967253, 4294967253, undef, 4294967253 }
  %r = select <4 x i1> %c, <4 x i32> %a, <4 x i32> { 4294967295, undef, 4294967295, 4294967295 }
  ret <4 x i32> %r
}
=>
define <4 x i32> @uadd_sat_constant_vec_commute_undefs(<4 x i32> %x) {
%0:
  %a = add <4 x i32> %x, { 42, 42, 42, undef }
  %c = icmp ult <4 x i32> %x, { 4294967253, 4294967253, undef, 4294967253 }
  %r = select <4 x i1> %c, <4 x i32> %a, <4 x i32> { 4294967295, undef, 4294967295, 4294967295 }
  ret <4 x i32> %r
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @unsigned_sat_variable_using_min_add(i32 %x) {
%0:
  %y = call i32 @get_i32()
  %noty = xor i32 %y, 4294967295
  %c = icmp ult i32 %x, %noty
  %s = select i1 %c, i32 %x, i32 %noty
  %r = add i32 %s, %y
  ret i32 %r
}
=>
define i32 @unsigned_sat_variable_using_min_add(i32 %x) {
%0:
  %y = call i32 @get_i32()
  %r = uadd_sat i32 %x, %y
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @unsigned_sat_variable_using_min_commute_add(i32 %x) {
%0:
  %y = call i32 @get_i32()
  %noty = xor i32 %y, 4294967295
  %c = icmp ult i32 %x, %noty
  %s = select i1 %c, i32 %x, i32 %noty
  %r = add i32 %y, %s
  ret i32 %r
}
=>
define i32 @unsigned_sat_variable_using_min_commute_add(i32 %x) {
%0:
  %y = call i32 @get_i32()
  %r = uadd_sat i32 %x, %y
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @unsigned_sat_variable_using_min_commute_select(<2 x i8> %x) {
%0:
  %y = call <2 x i8> @get_v2i8()
  %noty = xor <2 x i8> %y, { 255, 255 }
  %c = icmp ult <2 x i8> %noty, %x
  %s = select <2 x i1> %c, <2 x i8> %noty, <2 x i8> %x
  %r = add <2 x i8> %s, %y
  ret <2 x i8> %r
}
=>
define <2 x i8> @unsigned_sat_variable_using_min_commute_select(<2 x i8> %x) {
%0:
  %y = call <2 x i8> @get_v2i8()
  %r = uadd_sat <2 x i8> %x, %y
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @unsigned_sat_variable_using_min_commute_add_select(<2 x i8> %x) {
%0:
  %y = call <2 x i8> @get_v2i8()
  %noty = xor <2 x i8> %y, { 255, 255 }
  %c = icmp ult <2 x i8> %noty, %x
  %s = select <2 x i1> %c, <2 x i8> %noty, <2 x i8> %x
  %r = add <2 x i8> %y, %s
  ret <2 x i8> %r
}
=>
define <2 x i8> @unsigned_sat_variable_using_min_commute_add_select(<2 x i8> %x) {
%0:
  %y = call <2 x i8> @get_v2i8()
  %r = uadd_sat <2 x i8> %x, %y
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @unsigned_sat_variable_using_wrong_min(i32 %x) {
%0:
  %y = call i32 @get_i32()
  %noty = xor i32 %y, 4294967295
  %c = icmp slt i32 %x, %noty
  %s = select i1 %c, i32 %x, i32 %noty
  %r = add i32 %y, %s
  ret i32 %r
}
=>
define i32 @unsigned_sat_variable_using_wrong_min(i32 %x) {
%0:
  %y = call i32 @get_i32()
  %noty = xor i32 %y, 4294967295
  %c = icmp sgt i32 %noty, %x
  %s = select i1 %c, i32 %x, i32 %noty
  %r = add i32 %y, %s
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @unsigned_sat_variable_using_wrong_value(i32 %x, i32 %z) {
%0:
  %y = call i32 @get_i32()
  %noty = xor i32 %y, 4294967295
  %c = icmp ult i32 %x, %noty
  %s = select i1 %c, i32 %x, i32 %noty
  %r = add i32 %z, %s
  ret i32 %r
}
=>
define i32 @unsigned_sat_variable_using_wrong_value(i32 %x, i32 %z) {
%0:
  %y = call i32 @get_i32()
  %noty = xor i32 %y, 4294967295
  %c = icmp ugt i32 %noty, %x
  %s = select i1 %c, i32 %x, i32 %noty
  %r = add i32 %s, %z
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @unsigned_sat_constant_using_min(i32 %x) {
%0:
  %c = icmp ult i32 %x, 42
  %s = select i1 %c, i32 %x, i32 42
  %r = add i32 %s, 4294967253
  ret i32 %r
}
=>
define i32 @unsigned_sat_constant_using_min(i32 %x) {
%0:
  %r = uadd_sat i32 %x, 4294967253
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @unsigned_sat_constant_using_min_splat(<2 x i32> %x) {
%0:
  %c = icmp ult <2 x i32> %x, { 14, 14 }
  %s = select <2 x i1> %c, <2 x i32> %x, <2 x i32> { 14, 14 }
  %r = add <2 x i32> %s, { 4294967281, 4294967281 }
  ret <2 x i32> %r
}
=>
define <2 x i32> @unsigned_sat_constant_using_min_splat(<2 x i32> %x) {
%0:
  %r = uadd_sat <2 x i32> %x, { 4294967281, 4294967281 }
  ret <2 x i32> %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @unsigned_sat_constant_using_min_wrong_constant(i32 %x) {
%0:
  %c = icmp ult i32 %x, 42
  %s = select i1 %c, i32 %x, i32 42
  %r = add i32 %s, 4294967254
  ret i32 %r
}
=>
define i32 @unsigned_sat_constant_using_min_wrong_constant(i32 %x) {
%0:
  %c = icmp ult i32 %x, 42
  %s = select i1 %c, i32 %x, i32 42
  %r = add nsw i32 %s, 4294967254
  ret i32 %r
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source

Example:
i32 %x = undef

Source:
i1 %c = any
i32 %s = any
i32 %r = any

Target:
i1 %c = #x1 (1)
i32 %s = #x80000010 (2147483664, -2147483632)
i32 %r = poison
Source value: any
Target value: poison


------------------- SMT STATS -------------------
Num queries: 523
Num invalid: 0
Num skips:   0
Num trivial: 510 (49.4%)
Num timeout: 27 (5.2%)
Num errors:  0 (0.0%)
Num SAT:     152 (29.1%)
Num UNSAT:   344 (65.8%)

stderr:

+ : 'RUN: at line 2'
+ /home/nlopes/alive2/build/opt-alive.sh -instcombine -instcombine-infinite-loop-threshold=2 -S
+ /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/saturating-add-sub.ll

Alive2: Transform doesn't verify; aborting!
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/saturating-add-sub.ll

 

NOTE: This test would pass if undef didn't exist!

 

<-- Back