Name:
Anonymous
2016-10-01 6:42
http://stackoverflow.com/questions/11187150/gcc-weird-integer-promotion-schemeDid you know C standard silently promotes integers to larger size, because "its good for you". Portable assembler my ass.
Name:
Anonymous
2016-10-02 5:44
gcc.exe -S -Ofast -fno-except
ions -fno-asynchronous-unwind-tables
.file "test.c"
.text
.p2align 4,,15
.globl Fuint8_t
.def Fuint8_t; .scl 2; .type 32; .endef
Fuint8_t:
movzbl %cl, %eax
divb %dl
ret
.p2align 4,,15
.globl Fint8_t
.def Fint8_t; .scl 2; .type 32; .endef
Fint8_t:
movsbl %cl, %eax
movsbl %dl, %r8d
cltd
idivl %r8d
ret
.p2align 4,,15
.globl Fuint16_t
.def Fuint16_t; .scl 2; .type 32; .endef
Fuint16_t:
movl %edx, %r8d
movl %ecx, %eax
xorl %edx, %edx
divw %r8w
ret
.p2align 4,,15
.globl Fint16_t
.def Fint16_t; .scl 2; .type 32; .endef
Fint16_t:
movswl %cx, %eax
movswl %dx, %r8d
cltd
idivl %r8d
ret
.p2align 4,,15
.globl Funsigned
.def Funsigned; .scl 2; .type 32; .endef
Funsigned:
movl %edx, %r8d
movl %ecx, %eax
xorl %edx, %edx
divl %r8d
ret
.p2align 4,,15
.globl Fint
.def Fint; .scl 2; .type 32; .endef
Fint:
movl %ecx, %eax
movl %edx, %r8d
cltd
idivl %r8d
ret
.p2align 4,,15
.globl Fuint32_t
.def Fuint32_t; .scl 2; .type 32; .endef
Fuint32_t:
movl %edx, %r8d
movl %ecx, %eax
xorl %edx, %edx
divl %r8d
ret
.p2align 4,,15
.globl Fint32_t
.def Fint32_t; .scl 2; .type 32; .endef
Fint32_t:
movl %ecx, %eax
movl %edx, %r8d
cltd
idivl %r8d
ret
.p2align 4,,15
.globl Fuint64_t
.def Fuint64_t; .scl 2; .type 32; .endef
Fuint64_t:
movq %rdx, %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
ret
.p2align 4,,15
.globl Fint64_t
.def Fint64_t; .scl 2; .type 32; .endef
Fint64_t:
movq %rcx, %rax
movq %rdx, %r8
cqto
idivq %r8
ret
.ident "GCC: (GNU) 6.1.0"