-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 llvm-svn: 271386
- Loading branch information
1 parent
140b1fb
commit 6a89495
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; 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 | ||
} | ||
|