1 ; RUN: llc < %s -march=bpfel -show-mc-encoding | FileCheck %s
3 define void @test() #0 {
7 ; CHECK: r1 = 123 # encoding: [0xb7,0x01,0x00,0x00,0x7b,0x00,0x00,0x00]
9 call void @f_i16(i16 123)
11 ; CHECK: r1 = 12345678 # encoding: [0xb7,0x01,0x00,0x00,0x4e,0x61,0xbc,0x00]
13 call void @f_i32(i32 12345678)
15 ; CHECK: r1 = 72623859790382856 ll # encoding: [0x18,0x01,0x00,0x00,0x08,0x07,0x06,0x05,0x00,0x00,0x00,0x00,0x04,0x03,0x02,0x01]
17 call void @f_i64(i64 72623859790382856)
21 ; CHECK: call f_i32_i32
22 call void @f_i32_i32(i32 1234, i32 5678)
27 ; CHECK: call f_i16_i32_i16
28 call void @f_i16_i32_i16(i16 2, i32 3, i16 4)
31 ; CHECK: r2 = 7262385979038285 ll
33 ; CHECK: call f_i16_i64_i16
34 call void @f_i16_i64_i16(i16 5, i64 7262385979038285, i16 6)
39 @g_i16 = common global i16 0, align 2
40 @g_i32 = common global i32 0, align 2
41 @g_i64 = common global i64 0, align 4
43 define void @f_i16(i16 %a) #0 {
45 ; CHECK: *(u16 *)(r2 + 0) = r1 # encoding: [0x6b,0x12,0x00,0x00,0x00,0x00,0x00,0x00]
46 store volatile i16 %a, ptr @g_i16, align 2
50 define void @f_i32(i32 %a) #0 {
52 ; CHECK: *(u16 *)(r2 + 0) = r1 # encoding: [0x6b,0x12,0x00,0x00,0x00,0x00,0x00,0x00]
53 ; CHECK: *(u16 *)(r2 + 2) = r1 # encoding: [0x6b,0x12,0x02,0x00,0x00,0x00,0x00,0x00]
54 store volatile i32 %a, ptr @g_i32, align 2
58 define void @f_i64(i64 %a) #0 {
60 ; CHECK: *(u32 *)(r2 + 0) = r1
61 ; CHECK: *(u32 *)(r2 + 4) = r1 # encoding: [0x63,0x12,0x04,0x00,0x00,0x00,0x00,0x00]
62 store volatile i64 %a, ptr @g_i64, align 2
66 define void @f_i32_i32(i32 %a, i32 %b) #0 {
68 ; CHECK: *(u32 *)(r3 + 0) = r1
69 store volatile i32 %a, ptr @g_i32, align 4
70 ; CHECK: *(u32 *)(r3 + 0) = r2
71 store volatile i32 %b, ptr @g_i32, align 4
75 define void @f_i16_i32_i16(i16 %a, i32 %b, i16 %c) #0 {
76 ; CHECK: f_i16_i32_i16:
77 ; CHECK: *(u16 *)(r4 + 0) = r1
78 store volatile i16 %a, ptr @g_i16, align 2
79 ; CHECK: *(u32 *)(r1 + 0) = r2
80 store volatile i32 %b, ptr @g_i32, align 4
81 ; CHECK: *(u16 *)(r4 + 0) = r3
82 store volatile i16 %c, ptr @g_i16, align 2
86 define void @f_i16_i64_i16(i16 %a, i64 %b, i16 %c) #0 {
87 ; CHECK: f_i16_i64_i16:
88 ; CHECK: *(u16 *)(r4 + 0) = r1
89 store volatile i16 %a, ptr @g_i16, align 2
90 ; CHECK: *(u64 *)(r1 + 0) = r2 # encoding: [0x7b,0x21,0x00,0x00,0x00,0x00,0x00,0x00]
91 store volatile i64 %b, ptr @g_i64, align 8
92 ; CHECK: *(u16 *)(r4 + 0) = r3
93 store volatile i16 %c, ptr @g_i16, align 2