-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ISLE rules to generate 128-bit comparisons (#9176)
This commits adds pattern-matches to detect 128-bit comparisons encoded in 64-bit comparisons and promote them to 128-bit to enable backends to apply architecture-specific optimizations to these operations.
- Loading branch information
1 parent
03003c8
commit eb896ad
Showing
4 changed files
with
314 additions
and
2 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
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,236 @@ | ||
;;! target = "x86_64" | ||
;;! test = "optimize" | ||
|
||
(module | ||
(func $lt_s (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.lt_u | ||
local.get 1 | ||
local.get 3 | ||
i64.lt_s | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $lt_u (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.lt_u | ||
local.get 1 | ||
local.get 3 | ||
i64.lt_u | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $le_s (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.le_u | ||
local.get 1 | ||
local.get 3 | ||
i64.le_s | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $le_u (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.le_u | ||
local.get 1 | ||
local.get 3 | ||
i64.le_u | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $gt_s (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.gt_u | ||
local.get 1 | ||
local.get 3 | ||
i64.gt_s | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $gt_u (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.gt_u | ||
local.get 1 | ||
local.get 3 | ||
i64.gt_u | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $ge_s (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.ge_u | ||
local.get 1 | ||
local.get 3 | ||
i64.ge_s | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
(func $ge_u (param i64 i64 i64 i64) (result i32) | ||
local.get 0 | ||
local.get 2 | ||
i64.ge_u | ||
local.get 1 | ||
local.get 3 | ||
i64.ge_u | ||
local.get 1 | ||
local.get 3 | ||
i64.eq | ||
select | ||
) | ||
) | ||
;; function u0:0(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @0034 jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp slt v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @0034 return v20 | ||
;; } | ||
;; | ||
;; function u0:1(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @0047 jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp ult v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @0047 return v20 | ||
;; } | ||
;; | ||
;; function u0:2(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @005a jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp sle v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @005a return v20 | ||
;; } | ||
;; | ||
;; function u0:3(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @006d jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp ule v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @006d return v20 | ||
;; } | ||
;; | ||
;; function u0:4(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @0080 jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp sgt v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @0080 return v20 | ||
;; } | ||
;; | ||
;; function u0:5(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @0093 jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp ugt v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @0093 return v20 | ||
;; } | ||
;; | ||
;; function u0:6(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @00a6 jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp sge v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @00a6 return v20 | ||
;; } | ||
;; | ||
;; function u0:7(i64 vmctx, i64, i64, i64, i64, i64) -> i32 tail { | ||
;; gv0 = vmctx | ||
;; gv1 = load.i64 notrap aligned readonly gv0+8 | ||
;; gv2 = load.i64 notrap aligned gv1 | ||
;; stack_limit = gv2 | ||
;; | ||
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i64): | ||
;; @00b9 jump block1 | ||
;; | ||
;; block1: | ||
;; v16 = iconcat.i64 v2, v3 | ||
;; v17 = iconcat.i64 v4, v5 | ||
;; v18 = icmp uge v16, v17 | ||
;; v20 = uextend.i32 v18 | ||
;; @00b9 return v20 | ||
;; } |