xref: /llvm-project/llvm/test/CodeGen/AArch64/pr61549.ll (revision db158c7c830807caeeb0691739c41f1d522029e9)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=aarch64 | FileCheck %s
3; RUN: llc < %s -mtriple=aarch64 --global-isel | FileCheck %s --check-prefix=GISEL
4
5define i35 @f(i35 %0) {
6; CHECK-LABEL: f:
7; CHECK:       // %bb.0:
8; CHECK-NEXT:    sbfx x8, x0, #0, #35
9; CHECK-NEXT:    mov w9, #1 // =0x1
10; CHECK-NEXT:    sdiv x10, x9, x8
11; CHECK-NEXT:    msub x8, x10, x8, x9
12; CHECK-NEXT:    clz x8, x8
13; CHECK-NEXT:    sub x8, x8, #29
14; CHECK-NEXT:    ubfx x0, x8, #5, #30
15; CHECK-NEXT:    ret
16;
17; GISEL-LABEL: f:
18; GISEL:       // %bb.0:
19; GISEL-NEXT:    sbfx x8, x0, #0, #35
20; GISEL-NEXT:    mov w9, #1 // =0x1
21; GISEL-NEXT:    sdiv x10, x9, x8
22; GISEL-NEXT:    msub x8, x10, x8, x9
23; GISEL-NEXT:    and x8, x8, #0x7ffffffff
24; GISEL-NEXT:    clz x8, x8
25; GISEL-NEXT:    sub x8, x8, #29
26; GISEL-NEXT:    ubfx x0, x8, #5, #30
27; GISEL-NEXT:    ret
28  %2 = srem i35 1, %0
29  %3 = call i35 @llvm.ctlz.i35(i35 %2, i1 false)
30  %4 = lshr i35 %3, 5
31  ret i35 %4
32}
33
34declare i35 @llvm.ctlz.i35(i35, i1 immarg)
35