brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · d3bebf7 Raw
106 lines · plain
1; RUN: llc -mtriple=arm64-apple-ios < %s | FileCheck %s2 3define i64 @sbfiz64(i64 %v) {4; CHECK-LABEL: sbfiz64:5; CHECK: sbfiz	x0, x0, #1, #166  %shl = shl i64 %v, 487  %shr = ashr i64 %shl, 478  ret i64 %shr9}10 11define i32 @sbfiz32(i32 %v) {12; CHECK-LABEL: sbfiz32:13; CHECK: sbfiz	w0, w0, #1, #1414  %shl = shl i32 %v, 1815  %shr = ashr i32 %shl, 1716  ret i32 %shr17}18 19define i64 @ubfiz64(i64 %v) {20; CHECK-LABEL: ubfiz64:21; CHECK: ubfiz	x0, x0, #36, #1122  %shl = shl i64 %v, 5323  %shr = lshr i64 %shl, 1724  ret i64 %shr25}26 27define i32 @ubfiz32(i32 %v) {28; CHECK-LABEL: ubfiz32:29; CHECK: ubfiz	w0, w0, #6, #2430  %shl = shl i32 %v, 831  %shr = lshr i32 %shl, 232  ret i32 %shr33}34 35define i64 @ubfiz64and(i64 %v) {36; CHECK-LABEL: ubfiz64and:37; CHECK: ubfiz	x0, x0, #36, #1138  %shl = shl i64 %v, 3639  %and = and i64 %shl, 14066876887859240  ret i64 %and41}42 43define i32 @ubfiz32and(i32 %v) {44; CHECK-LABEL: ubfiz32and:45; CHECK: ubfiz	w0, w0, #6, #2446  %shl = shl i32 %v, 647  %and = and i32 %shl, 107374176048  ret i32 %and49}50 51; Check that we don't generate a ubfiz if the lsl has more than one52; use, since we'd just be replacing an and with a ubfiz.53define i32 @noubfiz32(i32 %v) {54; CHECK-LABEL: noubfiz32:55; CHECK: lsl	w[[REG1:[0-9]+]], w0, #656; CHECK: and	w[[REG2:[0-9]+]], w[[REG1]], #0x3fffffc057; CHECK: add	w0, w[[REG1]], w[[REG2]]58; CHECK: ret59  %shl = shl i32 %v, 660  %and = and i32 %shl, 107374176061  %add = add i32 %shl, %and62  ret i32 %add63}64 65define i64 @lsl32_not_ubfiz64(i64 %v) {66; CHECK-LABEL: lsl32_not_ubfiz64:67; CHECK: lsl	w0, w0, #668  %shl = shl i64 %v, 669  %and = and i64 %shl, 429496729570  ret i64 %and71}72 73define i64 @lsl_zext_i8_i64(i8 %b) {74; CHECK-LABEL: lsl_zext_i8_i64:75; CHECK:    ubfiz x0, x0, #1, #876  %1 = zext i8 %b to i6477  %2 = shl i64 %1, 178  ret i64 %279}80 81define i64 @lsl_zext_i16_i64(i16 %b) {82; CHECK-LABEL: lsl_zext_i16_i64:83; CHECK:    ubfiz x0, x0, #1, #1684  %1 = zext i16 %b to i6485  %2 = shl i64 %1, 186  ret i64 %287}88 89; Regression test for:90; https://github.com/llvm/llvm-project/pull/118974#issuecomment-259852187891; that exposed infinite loop in DAGCombiner.92define void @_f(ptr %0, ptr %1, i64 %2) {93; CHECK-LABEL: @_f94; CHECK-NOT: ubfiz95  store i64 -2401053089408754003, ptr %1, align 896  %4 = and i64 %2, -240105308940875400397  %5 = shl i64 %4, 198  store i64 %5, ptr %0, align 199  %6 = lshr i64 %4, 54100  %7 = shl i64 %2, 10101  %8 = and i64 %7, 131072102  %9 = or i64 %8, %6103  store i64 %9, ptr %1, align 1104  ret void105}106