flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Calling macro in AT&T

Author
Thread Post new topic Reply to topic
cvfirefox



Joined: 17 Oct 2008
Posts: 5
cvfirefox
Code:
# Copyright 1998-2004 - Just For Fun Software, Inc., all rights reserved

# Author: George Woltman
# Email: woltman@alum.mit.edu
#

# ********************************************************
# ********************************************************
# ******************** FFT MACROS **********************
# ********************************************************
# ********************************************************

## Perform a 32-element FFT.

.macro fft32
LOCAL b1b, c1b

## Do a forward FFT only

.if type EQ 1
call x32_fft
jmp xmiddle_1
.endif

## Do a squaring

.if type EQ 2
call x32_fft
call xmiddle_2
## jmp x32_finish_unfft
.endif

## Do a multiply

.if type EQ 3
call x32_fft
call xmiddle_3
jmp x32_finish_unfft
.endif

## Do a multiply with pre-FFTed inputs

.if type EQ 4
call xmiddle_4
jmp x32_finish_unfft
.endif

## Do FFT levels 1,2,3
## Values 0-31 is real data.
##
## On input the 32-byte cache lines hold these data values:
## 0 16 1 17
## 2 ...
## ... ...
## 14 ...
## On output the 32-byte cache lines hold these data values:
## 0 4 1 5
## 2 ...
## 8 ...
## ...

## Do 4 eight_reals_first_fft macros
## distance between fft data elements is 4

.if type EQ 1
x32_fft:
copy_7_words
subl %eax,%eax
b1b: disp eight_reals_first_fft, 4*dist1, 8*dist1, 8
leal dist1(%esi),%esi ## Next source pointer
addb $256/4, %al ## Test loop counter
jnc b1b ## Iterate if necessary
leal esi-4*dist1,%esi ## Restore source pointer

## End common FFT code

ret
.endif

## Do inverse FFT levels 1,2,3
## On input the 32-byte cache lines hold these data values:
## 0 4 1 5
## 2 ...
## 8 ...
## ...
## On output the 32-byte cache lines hold these data values:
## 0 16 1 17
## 2 ...
## ... ...
## 14 ...

## Do 4 eight_reals_last_unfft macros
## distance between fft data elements is 4

.if type EQ 2
x32_finish_unfft:
c1b: disp eight_reals_last_unfft, 8, 4*dist1, 8*dist1
leal dist1(%esi),%esi ## Next source pointer
addb $256/4, %al ## Test loop counter
jnc c1b ## Iterate if necessary
leal esi-4*dist1,%esi ## Restore source pointer
fft_3_ret
.endif
.endm
.end
    



How can I call this macro itself in itself?

_________________
-If you ain't first, then you're last.
Post 17 Oct 2008, 03:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
You can't, you need some other code to to the macro instantiation. Also note that the macro you posted is not the entire setup, it, in turn, instantiates other macros. You have taken a small portion of the whole program only. It can't work by itself.
Post 17 Oct 2008, 03:45
View user's profile Send private message Visit poster's website Reply with quote
cvfirefox



Joined: 17 Oct 2008
Posts: 5
cvfirefox
Thanks revolution

I've just solved my prob. I'm actually doing conversion from intel syn to AT&T syn. I crop this small macro part out and converted them to AT&T syn to output them to .o file and compare to the intel obj file. This is the part that I've converted.
Post 17 Oct 2008, 04:28
View user's profile Send private message Reply with quote
cvfirefox



Joined: 17 Oct 2008
Posts: 5
cvfirefox
By the way, the "LOCAL b1b, c1b " couldn't be understood by GAS. What is the GAS way of doing the "LOCAL b1b, c1b " ?
Post 17 Oct 2008, 04:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
I feel sorry for you that you have to convert the nice Intel syntax into the ugly AT&T syntax. I hope you don't go crazy in the process. Good luck.

As for how GAS handles locals, well I have no idea, perhaps the GAS manual can help?
Post 17 Oct 2008, 04:37
View user's profile Send private message Visit poster's website Reply with quote
cvfirefox



Joined: 17 Oct 2008
Posts: 5
cvfirefox
Yes Revolution, I think I'll hv to go for that
Thanks there bro
Post 17 Oct 2008, 07:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.