OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 1:35 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: What's the best assembly sequences for vm64z indexing?
PostPosted: Fri Apr 10, 2020 9:11 am 
Offline
Member
Member

Joined: Mon Feb 12, 2007 4:45 am
Posts: 146
e.g.

e0 = 0;
e1 = 8;
e2 = 16;
...


Top
 Profile  
 
 Post subject: Re: What's the best assembly sequences for vm64z indexing?
PostPosted: Fri Apr 10, 2020 9:45 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1590
You are going to have to write a little bit more than that. What is it you wish to do? If I have to google it, I can't answer your question.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: What's the best assembly sequences for vm64z indexing?
PostPosted: Fri Apr 10, 2020 10:03 am 
Offline
Member
Member

Joined: Mon Feb 12, 2007 4:45 am
Posts: 146
to form [ gpr_base + zmm0 + displacement ], vm64z.

It's a bit slow to use instruction mov zmm0, [ vm64z_index_from_memory ]


Top
 Profile  
 
 Post subject: Re: What's the best assembly sequences for vm64z indexing?
PostPosted: Fri Apr 10, 2020 11:29 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
blackoil wrote:
to form [ gpr_base + zmm0 + displacement ], vm64z.

It's a bit slow to use instruction mov zmm0, [ vm64z_index_from_memory ]
I lost you there. If zmm0 is supposed to be a floating point / SIMD register, then you can't use it for indexing and you can't use "mov". You have to use special instructions like "movaps" with those registers. Otherwise you can speed up the read by using only aligned values and prefetch.

Btw, with indexed addressing you can encode 3 bit shifts and a base in a single mov instruction (like [rbx + rax*8]), and reading memory with it into a gpr is not slow at all. Read about addressing modes in Intel spec.

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: What's the best assembly sequences for vm64z indexing?
PostPosted: Fri Apr 10, 2020 8:17 pm 
Offline
Member
Member

Joined: Mon Feb 12, 2007 4:45 am
Posts: 146
I used pseudo one.

vmovdqa64 zmm0, [index64] ; vindex instruction from armv8 can do this without memory read
vgatherqpd zmm1, [ rbx + zmm0 ] ; the zmm0 contains offsets for each element of zmm1.

index64:
dq 0
dq 16
dq 32
dq 48
dq 64
dq 80
dq 96
dq 112


Top
 Profile  
 
 Post subject: Re: What's the best assembly sequences for vm64z indexing?
PostPosted: Mon Apr 13, 2020 10:03 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5069
I don't think x86 has any way to do that without an extra memory access to load the indices.

Why is there an 8-byte gap between each of the values you want to load?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group