Skip to content

ADX intrinsics on beta don't use ADX instructions #663

Closed
@jethrogb

Description

@jethrogb

On nightly, they ICE. See rust-lang/rust#58020

unsafe fn add_1_2_3() -> u32{
    let mut out = 0;
    std::arch::x86_64::_addcarryx_u32(1, 2, 3, &mut out);
    out
}

fn main() {
    if is_x86_feature_detected!("adx") {
        println!("{}", unsafe { add_1_2_3() });
    }
}
$ rustc +beta --version
rustc 1.33.0-beta.3 (4df66ba86 2019-01-21)
$ rustc +beta adx.rs
$ objdump -d adx|grep -A10 -m1 carryx
00000000000060c0 <_ZN4core8coresimd3x863adx14_addcarryx_u3217h27a4e1bbc79875dcE>:
    60c0:	50                   	push   %rax
    60c1:	40 88 f8             	mov    %dil,%al
    60c4:	0f b6 f8             	movzbl %al,%edi
    60c7:	e8 b4 ff ff ff       	callq  6080 <_ZN4core8coresimd3x863adx13_addcarry_u3217hd2ae7a765daf0270E>
    60cc:	88 44 24 07          	mov    %al,0x7(%rsp)
    60d0:	8a 44 24 07          	mov    0x7(%rsp),%al
    60d4:	59                   	pop    %rcx
    60d5:	c3                   	retq   
    60d6:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
    60dd:	00 00 00 

As you can see, it just calls the non-ADX version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions