Displaying 20 results from an estimated 4000 matches similar to: "Lowering SEXT (and ZEXT) efficiently on Z80"
2018 Aug 06
2
Lowering ISD::TRUNCATE
I'm working on defining the instructions and implementing the lowering
code for a Z80 backend. For now, the backend supports only the native
CPU-supported datatypes, which are 8 and 16 bits wide (i.e. no 32 bit
long, float, ... yet).
So far, a lot of the simple stuff like immediate loads and return values
is very straightforward, but now I got stuck with ISD::TRUNCATE, as in:
2018 Jul 22
2
Finding scratch register after function call
>It should be possible to get llvm to produce very good code for the Z80...
Yes, I was thinking that too. These techniques didn't exist back then,
so I'm really looking forward to the point where the first regular C
sources can be compiled and see the magic happening in action live :)
------------------------------------------------------------------------
*From:* Bruce Hoult
2018 Jul 10
2
Stuck with instruction in tablegen
2018 Jul 10
2
Stuck with instruction in tablegen
Hi,
I'm trying to revive jacobly0's Z80 back-end (from
https://github.com/jacobly0/llvm-z80) and build it with a current
version of LLVM.
Apart from some interface changes, I'm stuck at building the tables.
Specifically, the generation of the DAG instruction selector causes an
assertion in the table generator:
Assertion failed: Ops.size() >= NumSrcResults &&
2018 Jul 22
2
Finding scratch register after function call
Thanks Bruce,
and elaborately as ever. Again, I'm surprised about your very thorough
Z80 knowledge when you said you only did little on the ZX81 in the
eighties :D
OK, understood. I was first thinking about doing something like this for
small frames:
1. push bc # 1 byte; 11 cycles - part of call frame-cleanup: save
scratch register
+-----begin call-related
2. ld
2018 Jul 25
2
Question about target instruction optimization
Yes, such optimizations are something for the "last 20%" of the project,
nice to have's.
As of now, I have yet to get a feeling of what LLVM can do on its own,
depending on what it's from the instruction tables and where it needs
help, and how much in other processing stages.
As this affects the way how the instruction info table will be set-up, I
appreciate your suggestions
2016 Oct 04
2
LLVM z80 backend and llvm-dis missing?
Inspired by Jason Turner's talk at CppCon 2016: Jason Turner “Rich Code
for Tiny Computers: A Simple Commodore 64 Game in C++17”
I got interested in writing a Zilog Z80 backend for LLVM. Jason actually
did no such thing, but instead wrote a x86-to-6502 translator (reassembler
he calls it) https://github.com/lefticus/x86-to-6502
So I'm now trying to bootstrap this project.
Goal:
- be
2018 Jul 25
2
Question about target instruction optimization
This is a question about optimizing the code generation in a (new) Z80
backend:
The CPU has a couple of 8 bit physical registers, e.g. H, L, D and E,
which are overlaid in 16 bit register pairs named HL and DE.
It has also a native instruction to load a 16 bit immediate value into a
16 bit register pair (HL or DE), e.g.:
LD HL,<imm16>
Now when having a sequence of loading two 16
2012 Apr 25
2
[LLVMdev] LLVM Backend for Z80. ADD -> replaced -> OR
Hello.
I am playing with LLVM and trying to make Z80 (Zilog Z80) backend.
The source code is attached.
I have succesfully made some simple test. But now I have problem with ADD
instruction.
The source C code is:
typedef struct
{
unsigned char id1;
unsigned char id2;
unsigned char id3;
} testS;
void simple()
{
testS test;
test.id1 = 0x40;
test.id2 = 0x80;
test.id3 = 0xc0;
}
It
2012 Apr 25
0
[LLVMdev] LLVM Backend for Z80. ADD -> replaced -> OR
Hi Peter,
I think the problem is that you did not explicitly define stack alignment
in Z80TargetMachine.cpp
DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-n8")
Try to add S16 to the string if your stack is 2-byte aligned. Refer to
http://llvm.org/docs/LangRef.html#datalayout .
If it does not work, try to specify the layout in the input module using
target layout directive.
David
On
2012 Apr 25
1
[LLVMdev] LLVM Backend for Z80. ADD -> replaced -> OR
Hello.
I have played with DataLayout and found a solution with is uknown to me.
I added S16 and also s0:16:16, but it had not worked.
Then I found that in Z80FrameLowering.h I am calling TargetFrameLowering
with stack aligment set to 8. So I changed it to 2 bytes. But this also
didn't help.
Then I changed llc to show TargetDataLayout and found that a option is set
to a0:0:64.
So I changed
2013 Feb 02
1
[LLVMdev] Trouble with instructions for lowering load/store.
Hello.
I write backend for Z80 cpu and I have some trouble with lowering
load/store nodes to different machine opcodes. Some target instructions
work with specified registers (not all registers in RegisterClass).
Often it's one or two registers. I don't understand how use
ComplexPattern in this case. But if I don't use ComplexPattern I'll have
other problems - not all
2018 Jul 21
2
Finding scratch register after function call
For a Z80 backend, "eliminateCallFramePseudoInstr()" shall adjust the
stack pointer in three possible ways, e.g. after a function call,
depending on the amount (= adjustment size) *and some other rules*:
1. via one or more target "pop <reg>" instructions (SP increments +2 per
instruction), using an unused reg (disregarding the contents after the
operation), followed
2012 Apr 18
0
[LLVMdev] [cfe-dev] LLVM Backend for Z80
Hi Peter,
(I'm CC'ing the LLVMdev list as there might be others able to help you)
I don't know this assertion, so can't help you with that particular problem.
But concerning "more debug info": Do you know the following two links?
http://llvm.org/releases/3.0/docs/ProgrammersManual.html#DEBUG
You can find some example debug code e.g. in method Select(SDNode *Node)
in
2013 Feb 23
2
[LLVMdev] Assertion failed after my storeRegToStackSlot/loadFromStackSlot
Hi All.
I'm writing storeRegToStackSlot and loadFromStackSlot function for my
Target. This Target can store/load one byte (not all word) from
FrameIndex. If I need to store 16 bit register I will must to split it
to two instruction like this:
BuildMI(MBB, MI, dl, get(Z80::LD8xmr))
.addFrameIndex(FrameIndex).addImm(0)
.addReg(SrcReg, 0, Z80::subreg_lo);
BuildMI(MBB, MI, dl,
2013 Mar 04
0
[LLVMdev] Assertion failed after my storeRegToStackSlot/loadFromStackSlot
Hi Dmitriy,
As you've seen our current spill code assumes that spill/reloads are single
instructions. I think the best way to work around this is to introduce
load/store pseudo-instructions and expand these after register allocation.
Cheers,
Lang.
On Sat, Feb 23, 2013 at 12:15 AM, Dmitriy Limonov <earl at excluzive.ws> wrote:
> Hi All.
>
> I'm writing
2012 Mar 11
0
[LLVMdev] LLVM backend for Z80 CPU
I want to make Z80 codegen backend to the LLVM. CLang+LLVM looks perfect,
while quick playing around. Some questions available:
1) Does LLVM support to generate "mixed" code ? For example: in
microcontrollers world the subroutine call with const arguments may be
decorated like this:
call subroutine
defw wArg1
defw wArg2
; ordinary code continues here
subroutine pop return address
2015 Jan 27
2
[LLVMdev] Making a CopyToReg/CopyFromReg into a zext/sext?
I have a CopyToReg that is copying from different size types, what's the
best way to change that to a zext or sext node based on signed or unsigned?
I'm fairly unfamiliar with SelectionDAG process (outside of the docs on
llvm website).
It seems like I should be able to insert a custom hook using the register
class to identify the type, potentially in ISelDAGToDag.cpp or is there a
better
2015 Jan 27
2
[LLVMdev] Making a CopyToReg/CopyFromReg into a zext/sext?
Thanks for getting back to me.
So those nodes record if the type has already been expanded from a narrower
type. Can you elaborate how I could use these to help? Again, I'm pretty
unfamiliar with the SDNodes.
Thanks.
On Tue, Jan 27, 2015 at 3:22 PM, Matt Arsenault <Matthew.Arsenault at amd.com>
wrote:
> On 01/27/2015 12:16 PM, Ryan Taylor wrote:
>
> I have a CopyToReg that
2015 May 06
2
[LLVMdev] [LoopVectorizer] Missed vectorization opportunities caused by sext/zext operations
For
void test0(unsigned short a, unsigned short * in, unsigned short * out) {
for (unsigned short w = 1; w < a - 1; w++) //this will never overflow
out[w] = in[w+7] * 2;
}
I think it will be sufficient to add a couple of new cases to
ScalarEvolution::HowManyLessThans --
zext(A) ult zext(B) == A ult B
sext(A) slt sext(B) == A slt B
Currently it bails out if it sees a non-add