2017-06-28 19:39:04 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL
|
|
|
|
|
2017-09-17 19:34:17 +08:00
|
|
|
define i32 @test_and_i1(i32 %arg1, i32 %arg2) {
|
|
|
|
; ALL-LABEL: test_and_i1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0:
|
2017-09-17 19:34:17 +08:00
|
|
|
; ALL-NEXT: cmpl %esi, %edi
|
|
|
|
; ALL-NEXT: sete %al
|
|
|
|
; ALL-NEXT: andb %al, %al
|
[GISel]: Rework legalization algorithm for better elimination of
artifacts along with DCE
Legalization Artifacts are all those insts that are there to make the
type system happy. Currently, the target needs to say all combinations
of extends and truncs are legal and there's no way of verifying that
post legalization, we only have *truly* legal instructions. This patch
changes roughly the legalization algorithm to process all illegal insts
at one go, and then process all truncs/extends that were added to
satisfy the type constraints separately trying to combine trivial cases
until they converge. This has the added benefit that, the target
legalizerinfo can only say which truncs and extends are okay and the
artifact combiner would combine away other exts and truncs.
Updated legalization algorithm to roughly the following pseudo code.
WorkList Insts, Artifacts;
collect_all_insts_and_artifacts(Insts, Artifacts);
do {
for (Inst in Insts)
legalizeInstrStep(Inst, Insts, Artifacts);
for (Artifact in Artifacts)
tryCombineArtifact(Artifact, Insts, Artifacts);
} while(!Insts.empty());
Also, wrote a simple wrapper equivalent to SetVector, except for
erasing, it avoids moving all elements over by one and instead just
nulls them out.
llvm-svn: 318210
2017-11-15 06:42:19 +08:00
|
|
|
; ALL-NEXT: movzbl %al, %eax
|
2017-09-17 19:34:17 +08:00
|
|
|
; ALL-NEXT: andl $1, %eax
|
|
|
|
; ALL-NEXT: retq
|
|
|
|
%c = icmp eq i32 %arg1, %arg2
|
|
|
|
%x = and i1 %c , %c
|
|
|
|
%ret = zext i1 %x to i32
|
|
|
|
ret i32 %ret
|
|
|
|
}
|
|
|
|
|
2018-09-20 18:59:08 +08:00
|
|
|
define i8 @test_and_i8(i8 %arg1, i8 %arg2) {
|
|
|
|
; ALL-LABEL: test_and_i8:
|
|
|
|
; ALL: # %bb.0:
|
|
|
|
; ALL-NEXT: movl %esi, %eax
|
|
|
|
; ALL-NEXT: andb %dil, %al
|
|
|
|
; ALL-NEXT: # kill: def $al killed $al killed $eax
|
|
|
|
; ALL-NEXT: retq
|
|
|
|
%ret = and i8 %arg1, %arg2
|
|
|
|
ret i8 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_and_i16(i16 %arg1, i16 %arg2) {
|
|
|
|
; ALL-LABEL: test_and_i16:
|
|
|
|
; ALL: # %bb.0:
|
|
|
|
; ALL-NEXT: movl %esi, %eax
|
|
|
|
; ALL-NEXT: andw %di, %ax
|
|
|
|
; ALL-NEXT: # kill: def $ax killed $ax killed $eax
|
|
|
|
; ALL-NEXT: retq
|
|
|
|
%ret = and i16 %arg1, %arg2
|
|
|
|
ret i16 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_and_i32(i32 %arg1, i32 %arg2) {
|
|
|
|
; ALL-LABEL: test_and_i32:
|
|
|
|
; ALL: # %bb.0:
|
|
|
|
; ALL-NEXT: movl %esi, %eax
|
|
|
|
; ALL-NEXT: andl %edi, %eax
|
|
|
|
; ALL-NEXT: retq
|
|
|
|
%ret = and i32 %arg1, %arg2
|
|
|
|
ret i32 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test_and_i64(i64 %arg1, i64 %arg2) {
|
|
|
|
; ALL-LABEL: test_and_i64:
|
|
|
|
; ALL: # %bb.0:
|
|
|
|
; ALL-NEXT: movq %rsi, %rax
|
|
|
|
; ALL-NEXT: andq %rdi, %rax
|
|
|
|
; ALL-NEXT: retq
|
|
|
|
%ret = and i64 %arg1, %arg2
|
|
|
|
ret i64 %ret
|
2017-06-28 19:39:04 +08:00
|
|
|
}
|
|
|
|
|