flat assembler
Message board for the users of flat assembler.
Index
> Main > bfloat16 |
Author |
|
Roman 04 Aug 2023, 11:33
I have one byte float value
Code: ;int DB 1,2,3 ;intResult DB 0 movzx eax,byte [int] cvtsi2ss xmm1,eax movzx eax,byte [int+1] cvtsi2ss xmm2,eax addss xmm1,xmm2 cvtss2si eax,xmm1 mov byte [intResult],al Last edited by Roman on 04 Aug 2023, 11:43; edited 1 time in total |
|||
04 Aug 2023, 11:33 |
|
Jin X 04 Aug 2023, 11:42
Roman, your answer in out of subject.
|
|||
04 Aug 2023, 11:42 |
|
Roman 04 Aug 2023, 11:45
Dw 1.0 create many problems.
Fpu and sse not work with 16 bit float values, only 32bit or 64bit We must always convert float16bit to float32bit |
|||
04 Aug 2023, 11:45 |
|
revolution 04 Aug 2023, 11:56
Jin X wrote: upd: Can I define such value (take high word of float32) now without using virtual + load keywords? Code: my_float = dword 1.0 mov ax,my_float shr 16 |
|||
04 Aug 2023, 11:56 |
|
Jin X 04 Aug 2023, 11:58
Roman, there're different instructions.
Some work with fp32 and fp64, some with fp16 (vaddph, vcmph, etc), some with bf16 (vdpbf16ps, AMX, etc). |
|||
04 Aug 2023, 11:58 |
|
Roman 04 Aug 2023, 11:59
And what we get ?
my_float = dword -2.25 mov ax,my_float shr 16 |
|||
04 Aug 2023, 11:59 |
|
Jin X 04 Aug 2023, 12:02
revolution, thanks!
Funny that: Code: x = (dword 1.0) shr 16 ; not compiled x = dword 1.0 x = x shr 16 ; ok Last edited by Jin X on 04 Aug 2023, 12:11; edited 1 time in total |
|||
04 Aug 2023, 12:02 |
|
Jin X 04 Aug 2023, 12:05
Code: ; Define bfloat16 number (high word of 32-bit float number) with optional name ; If fp32l <> 0 (default) then name label is shifted up by a word (to use it for access to 32-bit float value with undefined low word) macro df16 n*, name, fp32l=1 { local fp32 if ~ name eq if fp32l label name dword at $-2 else ; ~ fp32l label name word at $ end if ; [~] fp32l end if ; ~ name eq fp32 = dword (n) dw fp32 shr 16 } ; df16 ; Define bfloat16 number (high word of 32-bit float number) with optional name (and not shifted label) macro dbf16 n*, name { df16 n, name, 0 } ; dbf16 |
|||
04 Aug 2023, 12:05 |
|
Roman 04 Aug 2023, 12:11
I don't know where is need float 16 bit ?
I parsed old game demon stone 2004 Vertices(3D mesh) was as float 16 bit. That all I've seen it over 16 years, how I start write Directx games. Last edited by Roman on 04 Aug 2023, 18:19; edited 2 times in total |
|||
04 Aug 2023, 12:11 |
|
revolution 04 Aug 2023, 12:22
Jin X wrote: What about adding bfloat16 definition support? (https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) Instead: Code: mov ax,1.0 mov bx,1.0f dw 1.0 dw 1.0f f1 = word 1.0 That can also be extended to byte. Code: mov al,1.0 Edit: Just to be clear. At the time of writing fasm does not have any support for word or byte float values. The above is just a possibility. |
|||
04 Aug 2023, 12:22 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.