llvm/test/CodeGen/X86/bitscan.ll
Michael Zuckerman ac3b4c962d Adding back-end support to two bit scanning intrinsics
Adding LLVM back-end support to two intrinsics dealing with bit scan: _bit_scan_forward and _bit_scan_reverse.
Their functionality is as described in Intel intrinsics guide:
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bit_scan_forward&expand=371,370
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bit_scan_reverse&expand=371,370

Commit on behalf of Omer Paparo Bivas


Differential Revision: http://reviews.llvm.org/D19915



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 12:02:37 +00:00

24 lines
729 B
LLVM

; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7 | FileCheck %s --check-prefix=ALL --check-prefix=64-BIT
; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=corei7 | FileCheck %s --check-prefix=ALL --check-prefix=32-BIT
declare i32 @llvm.x86.bit.scan.forward.32(i32 %val)
declare i32 @llvm.x86.bit.scan.reverse.32(i32 %val)
define i32 @test_bsf(i32 %val) {
%call = call i32 @llvm.x86.bit.scan.forward.32(i32 %val)
ret i32 %call
; ALL-LABEL: test_bsf:
; 64-BIT: bsfl %edi, %eax
; 32-BIT: bsfl 4(%esp), %eax
}
define i32 @test_bsr(i32 %val) {
%call = call i32 @llvm.x86.bit.scan.reverse.32(i32 %val)
ret i32 %call
; ALL-LABEL: test_bsr:
; 64-BIT: bsrl %edi, %eax
; 32-BIT: bsrl 4(%esp), %eax
}