diff options
Diffstat (limited to 'llvm/test/CodeGen/X86/bmi.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/bmi.ll | 653 |
1 files changed, 0 insertions, 653 deletions
diff --git a/llvm/test/CodeGen/X86/bmi.ll b/llvm/test/CodeGen/X86/bmi.ll index 5ec2da420c4..2fc7cd5d1ca 100644 --- a/llvm/test/CodeGen/X86/bmi.ll +++ b/llvm/test/CodeGen/X86/bmi.ll @@ -431,659 +431,6 @@ entry: ret i32 %and } -define i32 @bzhi32b(i32 %x, i8 zeroext %index) { -; X86-BMI1-LABEL: bzhi32b: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movb {{[0-9]+}}(%esp), %cl -; X86-BMI1-NEXT: movl $1, %eax -; X86-BMI1-NEXT: shll %cl, %eax -; X86-BMI1-NEXT: decl %eax -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi32b: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %al -; X86-BMI2-NEXT: bzhil %eax, {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi32b: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $1, %eax -; X64-BMI1-NEXT: movl %esi, %ecx -; X64-BMI1-NEXT: shll %cl, %eax -; X64-BMI1-NEXT: decl %eax -; X64-BMI1-NEXT: andl %edi, %eax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi32b: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhil %esi, %edi, %eax -; X64-BMI2-NEXT: retq -entry: - %conv = zext i8 %index to i32 - %shl = shl i32 1, %conv - %sub = add nsw i32 %shl, -1 - %and = and i32 %sub, %x - ret i32 %and -} - -define i32 @bzhi32b_load(i32* %w, i8 zeroext %index) { -; X86-BMI1-LABEL: bzhi32b_load: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movl {{[0-9]+}}(%esp), %edx -; X86-BMI1-NEXT: movb {{[0-9]+}}(%esp), %cl -; X86-BMI1-NEXT: movl $1, %eax -; X86-BMI1-NEXT: shll %cl, %eax -; X86-BMI1-NEXT: decl %eax -; X86-BMI1-NEXT: andl (%edx), %eax -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi32b_load: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl -; X86-BMI2-NEXT: bzhil %ecx, (%eax), %eax -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi32b_load: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $1, %eax -; X64-BMI1-NEXT: movl %esi, %ecx -; X64-BMI1-NEXT: shll %cl, %eax -; X64-BMI1-NEXT: decl %eax -; X64-BMI1-NEXT: andl (%rdi), %eax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi32b_load: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhil %esi, (%rdi), %eax -; X64-BMI2-NEXT: retq -entry: - %x = load i32, i32* %w - %conv = zext i8 %index to i32 - %shl = shl i32 1, %conv - %sub = add nsw i32 %shl, -1 - %and = and i32 %sub, %x - ret i32 %and -} - -define i32 @bzhi32c(i32 %x, i8 zeroext %index) { -; X86-BMI1-LABEL: bzhi32c: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movb {{[0-9]+}}(%esp), %cl -; X86-BMI1-NEXT: movl $1, %eax -; X86-BMI1-NEXT: shll %cl, %eax -; X86-BMI1-NEXT: decl %eax -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi32c: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %al -; X86-BMI2-NEXT: bzhil %eax, {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi32c: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $1, %eax -; X64-BMI1-NEXT: movl %esi, %ecx -; X64-BMI1-NEXT: shll %cl, %eax -; X64-BMI1-NEXT: decl %eax -; X64-BMI1-NEXT: andl %edi, %eax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi32c: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhil %esi, %edi, %eax -; X64-BMI2-NEXT: retq -entry: - %conv = zext i8 %index to i32 - %shl = shl i32 1, %conv - %sub = add nsw i32 %shl, -1 - %and = and i32 %x, %sub - ret i32 %and -} - -define i32 @bzhi32d(i32 %a, i32 %b) { -; X86-BMI1-LABEL: bzhi32d: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movl $32, %ecx -; X86-BMI1-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI1-NEXT: movl $-1, %eax -; X86-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X86-BMI1-NEXT: shrl %cl, %eax -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi32d: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: bzhil %eax, {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi32d: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $32, %ecx -; X64-BMI1-NEXT: subl %esi, %ecx -; X64-BMI1-NEXT: movl $-1, %eax -; X64-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-BMI1-NEXT: shrl %cl, %eax -; X64-BMI1-NEXT: andl %edi, %eax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi32d: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhil %esi, %edi, %eax -; X64-BMI2-NEXT: retq -entry: - %sub = sub i32 32, %b - %shr = lshr i32 -1, %sub - %and = and i32 %shr, %a - ret i32 %and -} - -define i32 @bzhi32e(i32 %a, i32 %b) { -; X86-BMI1-LABEL: bzhi32e: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: movl $32, %ecx -; X86-BMI1-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI1-NEXT: shll %cl, %eax -; X86-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X86-BMI1-NEXT: shrl %cl, %eax -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi32e: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: bzhil %eax, {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi32e: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $32, %ecx -; X64-BMI1-NEXT: subl %esi, %ecx -; X64-BMI1-NEXT: shll %cl, %edi -; X64-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-BMI1-NEXT: shrl %cl, %edi -; X64-BMI1-NEXT: movl %edi, %eax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi32e: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhil %esi, %edi, %eax -; X64-BMI2-NEXT: retq -entry: - %sub = sub i32 32, %b - %shl = shl i32 %a, %sub - %shr = lshr i32 %shl, %sub - ret i32 %shr -} - -define i64 @bzhi64b(i64 %x, i8 zeroext %index) { -; X86-BMI1-LABEL: bzhi64b: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movb {{[0-9]+}}(%esp), %cl -; X86-BMI1-NEXT: movl $1, %eax -; X86-BMI1-NEXT: xorl %edx, %edx -; X86-BMI1-NEXT: shldl %cl, %eax, %edx -; X86-BMI1-NEXT: shll %cl, %eax -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: je .LBB27_2 -; X86-BMI1-NEXT: # %bb.1: -; X86-BMI1-NEXT: movl %eax, %edx -; X86-BMI1-NEXT: xorl %eax, %eax -; X86-BMI1-NEXT: .LBB27_2: # %entry -; X86-BMI1-NEXT: addl $-1, %eax -; X86-BMI1-NEXT: adcl $-1, %edx -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi64b: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movb {{[0-9]+}}(%esp), %cl -; X86-BMI2-NEXT: movl $1, %eax -; X86-BMI2-NEXT: xorl %edx, %edx -; X86-BMI2-NEXT: shldl %cl, %eax, %edx -; X86-BMI2-NEXT: shlxl %ecx, %eax, %eax -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: je .LBB27_2 -; X86-BMI2-NEXT: # %bb.1: -; X86-BMI2-NEXT: movl %eax, %edx -; X86-BMI2-NEXT: xorl %eax, %eax -; X86-BMI2-NEXT: .LBB27_2: # %entry -; X86-BMI2-NEXT: addl $-1, %eax -; X86-BMI2-NEXT: adcl $-1, %edx -; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64b: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $1, %eax -; X64-BMI1-NEXT: movl %esi, %ecx -; X64-BMI1-NEXT: shlq %cl, %rax -; X64-BMI1-NEXT: decq %rax -; X64-BMI1-NEXT: andq %rdi, %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64b: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: # kill: def $esi killed $esi def $rsi -; X64-BMI2-NEXT: bzhiq %rsi, %rdi, %rax -; X64-BMI2-NEXT: retq -entry: - %conv = zext i8 %index to i64 - %shl = shl i64 1, %conv - %sub = add nsw i64 %shl, -1 - %and = and i64 %x, %sub - ret i64 %and -} - -define i64 @bzhi64c(i64 %a, i64 %b) { -; X86-BMI1-LABEL: bzhi64c: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movl $64, %ecx -; X86-BMI1-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI1-NEXT: movl $-1, %eax -; X86-BMI1-NEXT: movl $-1, %edx -; X86-BMI1-NEXT: shrl %cl, %edx -; X86-BMI1-NEXT: shrdl %cl, %eax, %eax -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: je .LBB28_2 -; X86-BMI1-NEXT: # %bb.1: -; X86-BMI1-NEXT: movl %edx, %eax -; X86-BMI1-NEXT: xorl %edx, %edx -; X86-BMI1-NEXT: .LBB28_2: # %entry -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi64c: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movl $64, %ecx -; X86-BMI2-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI2-NEXT: movl $-1, %eax -; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx -; X86-BMI2-NEXT: shrdl %cl, %eax, %eax -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: je .LBB28_2 -; X86-BMI2-NEXT: # %bb.1: -; X86-BMI2-NEXT: movl %edx, %eax -; X86-BMI2-NEXT: xorl %edx, %edx -; X86-BMI2-NEXT: .LBB28_2: # %entry -; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64c: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $64, %ecx -; X64-BMI1-NEXT: subl %esi, %ecx -; X64-BMI1-NEXT: movq $-1, %rax -; X64-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-BMI1-NEXT: shrq %cl, %rax -; X64-BMI1-NEXT: andq %rdi, %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64c: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhiq %rsi, %rdi, %rax -; X64-BMI2-NEXT: retq -entry: - %sub = sub i64 64, %b - %shr = lshr i64 -1, %sub - %and = and i64 %shr, %a - ret i64 %and -} - -define i64 @bzhi64d(i64 %a, i32 %b) { -; X86-BMI1-LABEL: bzhi64d: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: movl $64, %ecx -; X86-BMI1-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI1-NEXT: movl $-1, %eax -; X86-BMI1-NEXT: movl $-1, %edx -; X86-BMI1-NEXT: shrl %cl, %edx -; X86-BMI1-NEXT: shrdl %cl, %eax, %eax -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: je .LBB29_2 -; X86-BMI1-NEXT: # %bb.1: -; X86-BMI1-NEXT: movl %edx, %eax -; X86-BMI1-NEXT: xorl %edx, %edx -; X86-BMI1-NEXT: .LBB29_2: # %entry -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi64d: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: movl $64, %ecx -; X86-BMI2-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI2-NEXT: movl $-1, %eax -; X86-BMI2-NEXT: shrxl %ecx, %eax, %edx -; X86-BMI2-NEXT: shrdl %cl, %eax, %eax -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: je .LBB29_2 -; X86-BMI2-NEXT: # %bb.1: -; X86-BMI2-NEXT: movl %edx, %eax -; X86-BMI2-NEXT: xorl %edx, %edx -; X86-BMI2-NEXT: .LBB29_2: # %entry -; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64d: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $64, %ecx -; X64-BMI1-NEXT: subl %esi, %ecx -; X64-BMI1-NEXT: movq $-1, %rax -; X64-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-BMI1-NEXT: shrq %cl, %rax -; X64-BMI1-NEXT: andq %rdi, %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64d: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: # kill: def $esi killed $esi def $rsi -; X64-BMI2-NEXT: bzhiq %rsi, %rdi, %rax -; X64-BMI2-NEXT: retq -entry: - %sub = sub i32 64, %b - %sh_prom = zext i32 %sub to i64 - %shr = lshr i64 -1, %sh_prom - %and = and i64 %shr, %a - ret i64 %and -} - -define i64 @bzhi64e(i64 %a, i64 %b) { -; X86-BMI1-LABEL: bzhi64e: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: pushl %ebx -; X86-BMI1-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI1-NEXT: pushl %edi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 12 -; X86-BMI1-NEXT: pushl %esi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 16 -; X86-BMI1-NEXT: .cfi_offset %esi, -16 -; X86-BMI1-NEXT: .cfi_offset %edi, -12 -; X86-BMI1-NEXT: .cfi_offset %ebx, -8 -; X86-BMI1-NEXT: movl {{[0-9]+}}(%esp), %edx -; X86-BMI1-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: movl $64, %ecx -; X86-BMI1-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI1-NEXT: movl %edx, %esi -; X86-BMI1-NEXT: shll %cl, %esi -; X86-BMI1-NEXT: shldl %cl, %edx, %eax -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: movl %esi, %edi -; X86-BMI1-NEXT: jne .LBB30_2 -; X86-BMI1-NEXT: # %bb.1: # %entry -; X86-BMI1-NEXT: movl %eax, %edi -; X86-BMI1-NEXT: .LBB30_2: # %entry -; X86-BMI1-NEXT: movl %edi, %eax -; X86-BMI1-NEXT: shrl %cl, %eax -; X86-BMI1-NEXT: xorl %ebx, %ebx -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: movl $0, %edx -; X86-BMI1-NEXT: jne .LBB30_4 -; X86-BMI1-NEXT: # %bb.3: # %entry -; X86-BMI1-NEXT: movl %esi, %ebx -; X86-BMI1-NEXT: movl %eax, %edx -; X86-BMI1-NEXT: .LBB30_4: # %entry -; X86-BMI1-NEXT: shrdl %cl, %edi, %ebx -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: jne .LBB30_6 -; X86-BMI1-NEXT: # %bb.5: # %entry -; X86-BMI1-NEXT: movl %ebx, %eax -; X86-BMI1-NEXT: .LBB30_6: # %entry -; X86-BMI1-NEXT: popl %esi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 12 -; X86-BMI1-NEXT: popl %edi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI1-NEXT: popl %ebx -; X86-BMI1-NEXT: .cfi_def_cfa_offset 4 -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi64e: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: pushl %edi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI2-NEXT: pushl %esi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 12 -; X86-BMI2-NEXT: .cfi_offset %esi, -12 -; X86-BMI2-NEXT: .cfi_offset %edi, -8 -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %esi -; X86-BMI2-NEXT: movl $64, %ecx -; X86-BMI2-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI2-NEXT: shldl %cl, %eax, %esi -; X86-BMI2-NEXT: shlxl %ecx, %eax, %edi -; X86-BMI2-NEXT: xorl %edx, %edx -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: je .LBB30_2 -; X86-BMI2-NEXT: # %bb.1: -; X86-BMI2-NEXT: movl %edi, %esi -; X86-BMI2-NEXT: movl $0, %edi -; X86-BMI2-NEXT: .LBB30_2: # %entry -; X86-BMI2-NEXT: shrxl %ecx, %esi, %eax -; X86-BMI2-NEXT: jne .LBB30_4 -; X86-BMI2-NEXT: # %bb.3: # %entry -; X86-BMI2-NEXT: movl %eax, %edx -; X86-BMI2-NEXT: .LBB30_4: # %entry -; X86-BMI2-NEXT: shrdl %cl, %esi, %edi -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: jne .LBB30_6 -; X86-BMI2-NEXT: # %bb.5: # %entry -; X86-BMI2-NEXT: movl %edi, %eax -; X86-BMI2-NEXT: .LBB30_6: # %entry -; X86-BMI2-NEXT: popl %esi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI2-NEXT: popl %edi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 4 -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64e: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $64, %ecx -; X64-BMI1-NEXT: subl %esi, %ecx -; X64-BMI1-NEXT: shlq %cl, %rdi -; X64-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-BMI1-NEXT: shrq %cl, %rdi -; X64-BMI1-NEXT: movq %rdi, %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64e: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: bzhiq %rsi, %rdi, %rax -; X64-BMI2-NEXT: retq -entry: - %sub = sub i64 64, %b - %shl = shl i64 %a, %sub - %shr = lshr i64 %shl, %sub - ret i64 %shr -} - -define i64 @bzhi64f(i64 %a, i32 %b) { -; X86-BMI1-LABEL: bzhi64f: -; X86-BMI1: # %bb.0: # %entry -; X86-BMI1-NEXT: pushl %ebx -; X86-BMI1-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI1-NEXT: pushl %edi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 12 -; X86-BMI1-NEXT: pushl %esi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 16 -; X86-BMI1-NEXT: .cfi_offset %esi, -16 -; X86-BMI1-NEXT: .cfi_offset %edi, -12 -; X86-BMI1-NEXT: .cfi_offset %ebx, -8 -; X86-BMI1-NEXT: movl {{[0-9]+}}(%esp), %edx -; X86-BMI1-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI1-NEXT: movl $64, %ecx -; X86-BMI1-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI1-NEXT: movl %edx, %esi -; X86-BMI1-NEXT: shll %cl, %esi -; X86-BMI1-NEXT: shldl %cl, %edx, %eax -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: movl %esi, %edi -; X86-BMI1-NEXT: jne .LBB31_2 -; X86-BMI1-NEXT: # %bb.1: # %entry -; X86-BMI1-NEXT: movl %eax, %edi -; X86-BMI1-NEXT: .LBB31_2: # %entry -; X86-BMI1-NEXT: movl %edi, %eax -; X86-BMI1-NEXT: shrl %cl, %eax -; X86-BMI1-NEXT: xorl %ebx, %ebx -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: movl $0, %edx -; X86-BMI1-NEXT: jne .LBB31_4 -; X86-BMI1-NEXT: # %bb.3: # %entry -; X86-BMI1-NEXT: movl %esi, %ebx -; X86-BMI1-NEXT: movl %eax, %edx -; X86-BMI1-NEXT: .LBB31_4: # %entry -; X86-BMI1-NEXT: shrdl %cl, %edi, %ebx -; X86-BMI1-NEXT: testb $32, %cl -; X86-BMI1-NEXT: jne .LBB31_6 -; X86-BMI1-NEXT: # %bb.5: # %entry -; X86-BMI1-NEXT: movl %ebx, %eax -; X86-BMI1-NEXT: .LBB31_6: # %entry -; X86-BMI1-NEXT: popl %esi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 12 -; X86-BMI1-NEXT: popl %edi -; X86-BMI1-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI1-NEXT: popl %ebx -; X86-BMI1-NEXT: .cfi_def_cfa_offset 4 -; X86-BMI1-NEXT: retl -; -; X86-BMI2-LABEL: bzhi64f: -; X86-BMI2: # %bb.0: # %entry -; X86-BMI2-NEXT: pushl %edi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI2-NEXT: pushl %esi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 12 -; X86-BMI2-NEXT: .cfi_offset %esi, -12 -; X86-BMI2-NEXT: .cfi_offset %edi, -8 -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-BMI2-NEXT: movl {{[0-9]+}}(%esp), %esi -; X86-BMI2-NEXT: movl $64, %ecx -; X86-BMI2-NEXT: subl {{[0-9]+}}(%esp), %ecx -; X86-BMI2-NEXT: shldl %cl, %eax, %esi -; X86-BMI2-NEXT: shlxl %ecx, %eax, %edi -; X86-BMI2-NEXT: xorl %edx, %edx -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: je .LBB31_2 -; X86-BMI2-NEXT: # %bb.1: -; X86-BMI2-NEXT: movl %edi, %esi -; X86-BMI2-NEXT: movl $0, %edi -; X86-BMI2-NEXT: .LBB31_2: # %entry -; X86-BMI2-NEXT: shrxl %ecx, %esi, %eax -; X86-BMI2-NEXT: jne .LBB31_4 -; X86-BMI2-NEXT: # %bb.3: # %entry -; X86-BMI2-NEXT: movl %eax, %edx -; X86-BMI2-NEXT: .LBB31_4: # %entry -; X86-BMI2-NEXT: shrdl %cl, %esi, %edi -; X86-BMI2-NEXT: testb $32, %cl -; X86-BMI2-NEXT: jne .LBB31_6 -; X86-BMI2-NEXT: # %bb.5: # %entry -; X86-BMI2-NEXT: movl %edi, %eax -; X86-BMI2-NEXT: .LBB31_6: # %entry -; X86-BMI2-NEXT: popl %esi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 8 -; X86-BMI2-NEXT: popl %edi -; X86-BMI2-NEXT: .cfi_def_cfa_offset 4 -; X86-BMI2-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64f: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $64, %ecx -; X64-BMI1-NEXT: subl %esi, %ecx -; X64-BMI1-NEXT: shlq %cl, %rdi -; X64-BMI1-NEXT: # kill: def $cl killed $cl killed $ecx -; X64-BMI1-NEXT: shrq %cl, %rdi -; X64-BMI1-NEXT: movq %rdi, %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64f: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: # kill: def $esi killed $esi def $rsi -; X64-BMI2-NEXT: bzhiq %rsi, %rdi, %rax -; X64-BMI2-NEXT: retq -entry: - %sub = sub i32 64, %b - %sh_prom = zext i32 %sub to i64 - %shl = shl i64 %a, %sh_prom - %shr = lshr i64 %shl, %sh_prom - ret i64 %shr -} - -define i64 @bzhi64_constant_mask(i64 %x) { -; X86-LABEL: bzhi64_constant_mask: -; X86: # %bb.0: # %entry -; X86-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-NEXT: movl $1073741823, %edx # imm = 0x3FFFFFFF -; X86-NEXT: andl {{[0-9]+}}(%esp), %edx -; X86-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64_constant_mask: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $15872, %eax # imm = 0x3E00 -; X64-BMI1-NEXT: bextrq %rax, %rdi, %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64_constant_mask: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: movb $62, %al -; X64-BMI2-NEXT: bzhiq %rax, %rdi, %rax -; X64-BMI2-NEXT: retq -entry: - %and = and i64 %x, 4611686018427387903 - ret i64 %and -} - -define i64 @bzhi64_constant_mask_load(i64* %x) { -; X86-LABEL: bzhi64_constant_mask_load: -; X86: # %bb.0: # %entry -; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X86-NEXT: movl (%ecx), %eax -; X86-NEXT: movl $1073741823, %edx # imm = 0x3FFFFFFF -; X86-NEXT: andl 4(%ecx), %edx -; X86-NEXT: retl -; -; X64-BMI1-LABEL: bzhi64_constant_mask_load: -; X64-BMI1: # %bb.0: # %entry -; X64-BMI1-NEXT: movl $15872, %eax # imm = 0x3E00 -; X64-BMI1-NEXT: bextrq %rax, (%rdi), %rax -; X64-BMI1-NEXT: retq -; -; X64-BMI2-LABEL: bzhi64_constant_mask_load: -; X64-BMI2: # %bb.0: # %entry -; X64-BMI2-NEXT: movb $62, %al -; X64-BMI2-NEXT: bzhiq %rax, (%rdi), %rax -; X64-BMI2-NEXT: retq -entry: - %x1 = load i64, i64* %x - %and = and i64 %x1, 4611686018427387903 - ret i64 %and -} - -define i64 @bzhi64_small_constant_mask(i64 %x) { -; X86-LABEL: bzhi64_small_constant_mask: -; X86: # %bb.0: # %entry -; X86-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF -; X86-NEXT: andl {{[0-9]+}}(%esp), %eax -; X86-NEXT: xorl %edx, %edx -; X86-NEXT: retl -; -; X64-LABEL: bzhi64_small_constant_mask: -; X64: # %bb.0: # %entry -; X64-NEXT: andl $2147483647, %edi # imm = 0x7FFFFFFF -; X64-NEXT: movq %rdi, %rax -; X64-NEXT: retq -entry: - %and = and i64 %x, 2147483647 - ret i64 %and -} - define i32 @blsi32(i32 %x) { ; X86-LABEL: blsi32: ; X86: # %bb.0: |