1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
3;
4; Test that DAGCombiner properly clears the NUW/NSW flags on the memoized add
5; node.
6
7define void @fun(i64* %Src, i32* %Dst) {
8; CHECK-LABEL: fun:
9; CHECK:       # %bb.0: # %entry
10; CHECK-NEXT:    iilf %r0, 1303940520
11; CHECK-NEXT:    n %r0, 4(%r2)
12; CHECK-NEXT:    lr %r1, %r0
13; CHECK-NEXT:    afi %r1, 1628135358
14; CHECK-NEXT:    locrnhe %r1, %r0
15; CHECK-NEXT:    st %r1, 0(%r3)
16; CHECK-NEXT:    br %r14
17entry:
18  %0 = load i64, i64* %Src, align 8
19  %1 = trunc i64 %0 to i32
20  %conv = and i32 %1, 1303940520
21  %xor11.i = or i32 %conv, -2147483648
22  %xor2.i = add i32 %xor11.i, -519348290
23  %cmp.i = icmp slt i32 %xor2.i, 0
24  %sub3.i = add nuw nsw i32 %conv, 1628135358
25  %cond.i = select i1 %cmp.i, i32 %conv, i32 %sub3.i
26  store i32 %cond.i, i32* %Dst
27  ret void
28}
29
30