www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - riscv64 codegen isn't ready yet?

reply Kagamin <spam here.lot> writes:
tried to compile
---
int aaa(int a, int b)
{
	return a+b;
}
---
ldc2 --mtriple=riscv64-unknown-linux -c test3.d
---
LLVM ERROR: Cannot select: 0x216e5fd67a8: ch = store<(store 4 
into %ir.3), trunc to i32> 0x216e5ff6818, 0x216e5fd6128, 
FrameIndex:i64<0>, undef:i64
   0x216e5fd6128: i64,ch = CopyFromReg 0x216e5ff6818, Register:i64 
%1
     0x216e5fd60c0: i64 = Register %1
   0x216e5fd6400: i64 = FrameIndex<0>
   0x216e5fd64d0: i64 = undef
In function: _D5test33aaaFiiZi
---
; [#uses = 0]

   %a = alloca i32, align 4                        ; [#uses = 2, 
size/byte = 4]
   %b = alloca i32, align 4                        ; [#uses = 2, 
size/byte = 4]
   store i32 %a_arg, i32* %a
   store i32 %b_arg, i32* %b
   %1 = load i32, i32* %a                          ; [#uses = 1]
   %2 = load i32, i32* %b                          ; [#uses = 1]
   %3 = add i32 %1, %2                             ; [#uses = 1]
   ret i32 %3
}
---
Works for riscv32.
Nov 07 2019
parent kinke <noone nowhere.com> writes:
It apparently needs an additional `-mcpu=generic-rv64` in the 
cmdline (doesn't like default `generic`).
Nov 08 2019