1 ; RUN: llc < %s -march=bpf -show-mc-encoding | FileCheck %s
2 ; test little endian only for now
4 define zeroext i8 @lshr8(i8 zeroext %a, i8 zeroext %cnt) nounwind readnone {
7 ; CHECK: srl r1, r2 # encoding: [0x7f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
8 %shr = lshr i8 %a, %cnt
12 define signext i8 @ashr8(i8 signext %a, i8 zeroext %cnt) nounwind readnone {
15 ; CHECK: sra r1, r2 # encoding: [0xcf,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
16 %shr = ashr i8 %a, %cnt
20 define zeroext i8 @shl8(i8 zeroext %a, i8 zeroext %cnt) nounwind readnone {
23 ; CHECK: sll r1, r2 # encoding: [0x6f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
24 %shl = shl i8 %a, %cnt
28 define zeroext i16 @lshr16(i16 zeroext %a, i16 zeroext %cnt) nounwind readnone {
30 ; CHECK-LABEL: lshr16:
31 ; CHECK: srl r1, r2 # encoding: [0x7f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
32 %shr = lshr i16 %a, %cnt
36 define signext i16 @ashr16(i16 signext %a, i16 zeroext %cnt) nounwind readnone {
38 ; CHECK-LABEL: ashr16:
39 ; CHECK: sra r1, r2 # encoding: [0xcf,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
40 %shr = ashr i16 %a, %cnt
44 define zeroext i16 @shl16(i16 zeroext %a, i16 zeroext %cnt) nounwind readnone {
47 ; CHECK: sll r1, r2 # encoding: [0x6f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
48 %shl = shl i16 %a, %cnt
52 define zeroext i32 @lshr32(i32 zeroext %a, i32 zeroext %cnt) nounwind readnone {
54 ; CHECK-LABEL: lshr32:
55 ; CHECK: srl r1, r2 # encoding: [0x7f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
56 ; CHECK: slli r1, 32 # encoding: [0x67,0x01,0x00,0x00,0x20,0x00,0x00,0x00]
57 %shr = lshr i32 %a, %cnt
61 define signext i32 @ashr32(i32 signext %a, i32 zeroext %cnt) nounwind readnone {
63 ; CHECK-LABEL: ashr32:
64 ; CHECK: sra r1, r2 # encoding: [0xcf,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
65 %shr = ashr i32 %a, %cnt
69 define zeroext i32 @shl32(i32 zeroext %a, i32 zeroext %cnt) nounwind readnone {
72 ; CHECK: sll r1, r2 # encoding: [0x6f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
73 %shl = shl i32 %a, %cnt
77 define zeroext i64 @lshr64(i64 zeroext %a, i64 zeroext %cnt) nounwind readnone {
79 ; CHECK-LABEL: lshr64:
80 ; CHECK: srl r1, r2 # encoding: [0x7f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
81 %shr = lshr i64 %a, %cnt
85 define signext i64 @ashr64(i64 signext %a, i64 zeroext %cnt) nounwind readnone {
87 ; CHECK-LABEL: ashr64:
88 ; CHECK: sra r1, r2 # encoding: [0xcf,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
89 %shr = ashr i64 %a, %cnt
93 define zeroext i64 @shl64(i64 zeroext %a, i64 zeroext %cnt) nounwind readnone {
96 ; CHECK: sll r1, r2 # encoding: [0x6f,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
97 ; CHECK: mov r0, r1 # encoding: [0xbf,0x10,0x00,0x00,0x00,0x00,0x00,0x00]
98 ; CHECK: ret # encoding: [0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
99 %shl = shl i64 %a, %cnt