1; Test fix for PR-13709. 2; RUN: llc -mtriple=hexagon < %s | FileCheck %s 3; CHECK: f0 4; CHECK-NOT: lsr(r{{[0-9]+}}:{{[0-9]+}}, #32) 5; CHECK-NOT: lsr(r{{[0-9]+}}:{{[0-9]+}}, #32) 6 7; Convert the sequence 8; r17:16 = lsr(r11:10, #32) 9; .. = r16 10; into 11; r17:16 = lsr(r11:10, #32) 12; .. = r11 13; This makes the lsr instruction dead and it gets removed subsequently 14; by a dead code removal pass. 15 16 17%s.0 = type { i64 } 18%s.1 = type { i32 } 19 20define void @f0(ptr nocapture %a0, ptr nocapture %a1, ptr nocapture %a2, ptr nocapture %a3, ptr nocapture %a4) #0 { 21b0: 22 %v0 = getelementptr %s.0, ptr %a0, i32 1 23 %v1 = getelementptr %s.1, ptr %a2, i32 1 24 %v2 = getelementptr %s.1, ptr %a1, i32 1 25 %v3 = getelementptr i8, ptr %a4, i32 1 26 %v4 = getelementptr i8, ptr %a3, i32 1 27 br label %b1 28 29b1: ; preds = %b1, %b0 30 %v5 = phi i32 [ %v38, %b1 ], [ 2, %b0 ] 31 %v6 = phi ptr [ %v37, %b1 ], [ %v4, %b0 ] 32 %v7 = phi ptr [ %v36, %b1 ], [ %v3, %b0 ] 33 %v8 = phi ptr [ %v35, %b1 ], [ %v2, %b0 ] 34 %v9 = phi ptr [ %v34, %b1 ], [ %v1, %b0 ] 35 %v10 = phi ptr [ %v33, %b1 ], [ %v0, %b0 ] 36 %v11 = phi i8 [ undef, %b0 ], [ %v30, %b1 ] 37 %v12 = phi i8 [ undef, %b0 ], [ %v29, %b1 ] 38 %v13 = phi i64 [ undef, %b0 ], [ %v28, %b1 ] 39 %v17 = tail call i64 @llvm.hexagon.A2.vsubhs(i64 0, i64 %v13) 40 %v18 = sext i8 %v12 to i32 41 %v19 = trunc i64 %v13 to i32 42 %v20 = trunc i64 %v17 to i32 43 %v21 = tail call i32 @llvm.hexagon.C2.mux(i32 %v18, i32 %v19, i32 %v20) 44 store i32 %v21, ptr %v8, align 4 45 %v22 = sext i8 %v11 to i32 46 %v23 = lshr i64 %v13, 32 47 %v24 = trunc i64 %v23 to i32 48 %v25 = lshr i64 %v17, 32 49 %v26 = trunc i64 %v25 to i32 50 %v27 = tail call i32 @llvm.hexagon.C2.mux(i32 %v22, i32 %v24, i32 %v26) 51 store i32 %v27, ptr %v9, align 4 52 %v28 = load i64, ptr %v10, align 8 53 %v29 = load i8, ptr %v6, align 1 54 %v30 = load i8, ptr %v7, align 1 55 %v31 = trunc i32 %v5 to i8 56 %v32 = icmp eq i8 %v31, 32 57 %v33 = getelementptr %s.0, ptr %v10, i32 1 58 %v34 = getelementptr %s.1, ptr %v9, i32 1 59 %v35 = getelementptr %s.1, ptr %v8, i32 1 60 %v36 = getelementptr i8, ptr %v7, i32 1 61 %v37 = getelementptr i8, ptr %v6, i32 1 62 %v38 = add i32 %v5, 1 63 br i1 %v32, label %b2, label %b1 64 65b2: ; preds = %b1 66 ret void 67} 68 69declare i64 @llvm.hexagon.A2.vsubhs(i64, i64) #1 70declare i32 @llvm.hexagon.C2.mux(i32, i32, i32) #1 71 72attributes #0 = { nounwind "target-cpu"="hexagonv5" } 73attributes #1 = { nounwind readnone "target-cpu"="hexagonv5" } 74