1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
Yonghong Song 75e988b98f bpf: add " ll" in the LD_IMM64 asmstring
This partially revert previous fix in commit f5858045aa0b
("bpf: proper print imm64 expression in inst printer").

In that commit, the original suffix "ll" is removed from
LD_IMM64 asmstring. In the customer print method, the "ll"
suffix is printed if the rhs is an immediate. For example,
"r2 = 5ll" => "r2 = 5ll", and "r3 = varll" => "r3 = var".

This has an issue though for assembler. Since assembler
relies on asmstring to do pattern matching, it will not
be able to distiguish between "mov r2, 5" and
"ld_imm64 r2, 5" since both asmstring is "r2 = 5".
In such cases, the assembler uses 64bit load for all
"r = <val>" asm insts.

This patch adds back " ll" suffix for ld_imm64 with one
additional space for "#reg = #global_var" case.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 312978
2017-09-11 23:43:35 +00:00

49 lines
874 B
LLVM

; RUN: not llc < %s -march=bpfel | FileCheck %s
define void @test() #0 {
entry:
; CHECK: test:
; CHECK: call f_i16
; CHECK: *(u16 *)(r1 + 0) = r0
%0 = call i16 @f_i16()
store volatile i16 %0, i16* @g_i16
; CHECK: call f_i32
; CHECK: *(u32 *)(r1 + 0) = r0
%1 = call i32 @f_i32()
store volatile i32 %1, i32* @g_i32
; CHECK: call f_i64
; CHECK: *(u64 *)(r1 + 0) = r0
%2 = call i64 @f_i64()
store volatile i64 %2, i64* @g_i64
ret void
}
@g_i16 = common global i16 0, align 2
@g_i32 = common global i32 0, align 2
@g_i64 = common global i64 0, align 2
define i16 @f_i16() #0 {
; CHECK: f_i16:
; CHECK: r0 = 1
; CHECK: exit
ret i16 1
}
define i32 @f_i32() #0 {
; CHECK: f_i32:
; CHECK: r0 = 16909060
; CHECK: exit
ret i32 16909060
}
define i64 @f_i64() #0 {
; CHECK: f_i64:
; CHECK: r0 = 72623859790382856 ll
; CHECK: exit
ret i64 72623859790382856
}