1 ; RUN: llc -march=hexagon < %s | FileCheck %s
2 ; This testcase crashed, because we propagated a reg:sub into a tied use.
3 ; The two-address pass rewrote it in a way that generated incorrect code.
4 ; CHECK: r{{[0-9]+}} += lsr(r{{[0-9]+}},#16)
6 target triple = "hexagon"
8 define i64 @fred(i64 %x) local_unnamed_addr #0 {
10 %t.sroa.0.0.extract.trunc = trunc i64 %x to i32
11 %t4.sroa.4.0.extract.shift = lshr i64 %x, 16
12 %add11 = add i32 0, %t.sroa.0.0.extract.trunc
13 %t14.sroa.3.0.extract.trunc = trunc i64 %t4.sroa.4.0.extract.shift to i32
14 %t14.sroa.4.0.extract.shift = lshr i64 %x, 24
15 %add21 = add i32 %add11, %t14.sroa.3.0.extract.trunc
16 %t24.sroa.3.0.extract.trunc = trunc i64 %t14.sroa.4.0.extract.shift to i32
17 %add31 = add i32 %add21, %t24.sroa.3.0.extract.trunc
18 %conv32.mask = and i32 %add31, 255
19 %conv33 = zext i32 %conv32.mask to i64
23 attributes #0 = { norecurse nounwind readnone }