1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32
3
4define i32 @ctlz_i32(i32 %a) {
5; MIPS32-LABEL: ctlz_i32:
6; MIPS32:       # %bb.0: # %entry
7; MIPS32-NEXT:    clz $2, $4
8; MIPS32-NEXT:    jr $ra
9; MIPS32-NEXT:    nop
10entry:
11  %0 = call i32 @llvm.ctlz.i32(i32 %a, i1 false)
12  ret i32 %0
13}
14declare i32 @llvm.ctlz.i32(i32, i1 immarg)
15
16
17define i64 @ctlz_i64(i64 %a) {
18; MIPS32-LABEL: ctlz_i64:
19; MIPS32:       # %bb.0: # %entry
20; MIPS32-NEXT:    move $1, $4
21; MIPS32-NEXT:    ori $3, $zero, 0
22; MIPS32-NEXT:    sltiu $4, $5, 1
23; MIPS32-NEXT:    clz $1, $1
24; MIPS32-NEXT:    addiu $1, $1, 32
25; MIPS32-NEXT:    clz $2, $5
26; MIPS32-NEXT:    andi $4, $4, 1
27; MIPS32-NEXT:    movn $2, $1, $4
28; MIPS32-NEXT:    jr $ra
29; MIPS32-NEXT:    nop
30entry:
31  %0 = call i64 @llvm.ctlz.i64(i64 %a, i1 false)
32  ret i64 %0
33}
34declare i64 @llvm.ctlz.i64(i64, i1 immarg)
35