2016-11-17 06:38:43 +08:00
|
|
|
; RUN: llc < %s -march=avr | FileCheck %s
|
|
|
|
|
|
|
|
define i8 @count_leading_zeros(i8) unnamed_addr {
|
|
|
|
entry-block:
|
|
|
|
%1 = tail call i8 @llvm.ctlz.i8(i8 %0)
|
|
|
|
ret i8 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i8 @llvm.ctlz.i8(i8)
|
|
|
|
|
|
|
|
; CHECK-LABEL: count_leading_zeros:
|
|
|
|
; CHECK: cpi [[RESULT:r[0-9]+]], 0
|
2021-01-23 23:54:16 +08:00
|
|
|
; CHECK: breq .LBB0_2
|
2016-11-17 06:38:43 +08:00
|
|
|
; CHECK: mov [[SCRATCH:r[0-9]+]], {{.*}}[[RESULT]]
|
|
|
|
; CHECK: lsr {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: or {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
|
|
|
; CHECK: mov {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: lsr {{.*}}[[RESULT]]
|
|
|
|
; CHECK: lsr {{.*}}[[RESULT]]
|
|
|
|
; CHECK: or {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: mov {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
2021-01-23 23:54:16 +08:00
|
|
|
; CHECK: swap {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: andi {{.*}}[[SCRATCH]], 15
|
2016-11-17 06:38:43 +08:00
|
|
|
; CHECK: or {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
|
|
|
; CHECK: com {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: mov {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: lsr {{.*}}[[RESULT]]
|
|
|
|
; CHECK: andi {{.*}}[[RESULT]], 85
|
|
|
|
; CHECK: sub {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
|
|
|
; CHECK: mov {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: andi {{.*}}[[RESULT]], 51
|
|
|
|
; CHECK: lsr {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: lsr {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: andi {{.*}}[[SCRATCH]], 51
|
|
|
|
; CHECK: add {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
|
|
|
; CHECK: mov {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
2021-01-23 23:54:16 +08:00
|
|
|
; CHECK: swap {{.*}}[[RESULT]]
|
2016-11-17 06:38:43 +08:00
|
|
|
; CHECK: add {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
|
|
; CHECK: andi {{.*}}[[RESULT]], 15
|
|
|
|
; CHECK: ret
|
2017-07-11 12:17:13 +08:00
|
|
|
; CHECK: LBB0_2:
|
2016-11-17 06:38:43 +08:00
|
|
|
; CHECK: ldi {{.*}}[[RESULT]], 8
|
|
|
|
; CHECK: ret
|