diff --git a/ir_x86.dasc b/ir_x86.dasc index 2b56bab..5b11976 100644 --- a/ir_x86.dasc +++ b/ir_x86.dasc @@ -2257,16 +2257,16 @@ static void ir_emit_min_max_int(ir_ctx *ctx, ir_ref def, ir_insn *insn) | ASM_REG_REG_OP cmp, type, def_reg, op2_reg if (insn->op == IR_MIN) { if (IR_IS_TYPE_SIGNED(type)) { - | ASM_REG_REG_OP2 cmovl, type, def_reg, op2_reg + | ASM_REG_REG_OP2 cmovg, type, def_reg, op2_reg } else { - | ASM_REG_REG_OP2 cmovb, type, def_reg, op2_reg + | ASM_REG_REG_OP2 cmova, type, def_reg, op2_reg } } else { IR_ASSERT(insn->op == IR_MAX); if (IR_IS_TYPE_SIGNED(type)) { - | ASM_REG_REG_OP2 cmovg, type, def_reg, op2_reg - } else { | ASM_REG_REG_OP2 cmova, type, def_reg, op2_reg + } else { + | ASM_REG_REG_OP2 cmovg, type, def_reg, op2_reg } } diff --git a/tests/x86/min_005.irt b/tests/x86/min_005.irt index e3dab8d..6929a7a 100644 --- a/tests/x86/min_005.irt +++ b/tests/x86/min_005.irt @@ -17,6 +17,6 @@ test: movl 4(%esp), %eax movl 8(%esp), %ecx cmpl %eax, %ecx - cmovll %eax, %ecx + cmovgl %eax, %ecx movl %ecx, %eax retl diff --git a/tests/x86/min_006.irt b/tests/x86/min_006.irt index 453c9e9..72c793d 100644 --- a/tests/x86/min_006.irt +++ b/tests/x86/min_006.irt @@ -17,6 +17,6 @@ test: movb 4(%esp), %al movb 8(%esp), %cl cmpb %al, %cl - cmovbw %ax, %cx + cmovaw %ax, %cx movb %cl, %al retl diff --git a/tests/x86/min_007.irt b/tests/x86/min_007.irt index 599ca3c..042867a 100644 --- a/tests/x86/min_007.irt +++ b/tests/x86/min_007.irt @@ -17,5 +17,5 @@ test: movl 4(%esp), %eax movl $0x2f, %ecx cmpl %ecx, %eax - cmovll %ecx, %eax + cmovgl %ecx, %eax retl diff --git a/tests/x86_64/min_005.irt b/tests/x86_64/min_005.irt index 98bc6a1..c16d5d3 100644 --- a/tests/x86_64/min_005.irt +++ b/tests/x86_64/min_005.irt @@ -16,5 +16,5 @@ x86_64 test: movl %esi, %eax cmpl %edi, %eax - cmovll %edi, %eax + cmovgl %edi, %eax retq diff --git a/tests/x86_64/min_006.irt b/tests/x86_64/min_006.irt index 0af8808..ebb78f2 100644 --- a/tests/x86_64/min_006.irt +++ b/tests/x86_64/min_006.irt @@ -16,5 +16,5 @@ x86_64 test: movb %sil, %al cmpb %dil, %al - cmovbw %di, %ax + cmovaw %di, %ax retq diff --git a/tests/x86_64/min_007.irt b/tests/x86_64/min_007.irt index 842664f..61ff9da 100644 --- a/tests/x86_64/min_007.irt +++ b/tests/x86_64/min_007.irt @@ -17,5 +17,5 @@ test: movl %edi, %eax movl $0x2f, %ecx cmpl %ecx, %eax - cmovll %ecx, %eax + cmovgl %ecx, %eax retq