fgettype() test: Skip useless tests (lea/cmp/cmove) if correct filetype was detected

This commit is contained in:
2025-07-27 15:08:07 +02:00
parent 310c199942
commit 0c5bbde4a4

View File

@@ -1326,25 +1326,32 @@ _start:
lea rsi, [rel ftype_dir] lea rsi, [rel ftype_dir]
cmp rax, S_IFDIR cmp rax, S_IFDIR
cmove rdx, rsi cmove rdx, rsi
je .fgettype_cnt
lea rsi, [rel ftype_char] lea rsi, [rel ftype_char]
cmp rax, S_IFCHR cmp rax, S_IFCHR
cmove rdx, rsi cmove rdx, rsi
je .fgettype_cnt
lea rsi, [rel ftype_blk] lea rsi, [rel ftype_blk]
cmp rax, S_IFBLK cmp rax, S_IFBLK
cmove rdx, rsi cmove rdx, rsi
je .fgettype_cnt
lea rsi, [rel ftype_reg] lea rsi, [rel ftype_reg]
cmp rax, S_IFREG cmp rax, S_IFREG
cmove rdx, rsi cmove rdx, rsi
je .fgettype_cnt
lea rsi, [rel ftype_fifo] lea rsi, [rel ftype_fifo]
cmp rax, S_IFIFO cmp rax, S_IFIFO
cmove rdx, rsi cmove rdx, rsi
je .fgettype_cnt
lea rsi, [rel ftype_link] lea rsi, [rel ftype_link]
cmp rax, S_IFLNK cmp rax, S_IFLNK
cmove rdx, rsi cmove rdx, rsi
je .fgettype_cnt
lea rsi, [rel ftype_sock] lea rsi, [rel ftype_sock]
cmp rax, S_IFSOCK cmp rax, S_IFSOCK
cmove rdx, rsi cmove rdx, rsi
.fgettype_cnt:
lea rdi, [rel fgettypeStr] lea rdi, [rel fgettypeStr]
lea rsi, [rel file1] lea rsi, [rel file1]
call printf call printf