2017-05-01 14:30:16 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2017-05-21 19:13:56 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
|
|
|
|
; RUN: llc -mtriple=i386-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X32
|
2017-05-01 14:30:16 +08:00
|
|
|
|
2017-07-10 17:07:34 +08:00
|
|
|
define i8 @test_zext_i1toi8(i32 %a) {
|
|
|
|
; X64-LABEL: test_zext_i1toi8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-07-10 17:07:34 +08:00
|
|
|
; X64-NEXT: andb $1, %dil
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_zext_i1toi8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-07-10 17:07:34 +08:00
|
|
|
; X32-NEXT: andb $1, %al
|
2017-11-29 01:15:09 +08:00
|
|
|
; X32-NEXT: # kill: %al<def> %al<kill> %eax<kill>
|
2017-07-10 17:07:34 +08:00
|
|
|
; X32-NEXT: retl
|
|
|
|
%val = trunc i32 %a to i1
|
|
|
|
%r = zext i1 %val to i8
|
|
|
|
ret i8 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_zext_i1toi16(i32 %a) {
|
|
|
|
; X64-LABEL: test_zext_i1toi16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-07-10 17:07:34 +08:00
|
|
|
; X64-NEXT: andw $1, %di
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_zext_i1toi16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-07-10 17:07:34 +08:00
|
|
|
; X32-NEXT: andw $1, %ax
|
2017-11-29 01:15:09 +08:00
|
|
|
; X32-NEXT: # kill: %ax<def> %ax<kill> %eax<kill>
|
2017-07-10 17:07:34 +08:00
|
|
|
; X32-NEXT: retl
|
|
|
|
%val = trunc i32 %a to i1
|
|
|
|
%r = zext i1 %val to i16
|
|
|
|
ret i16 %r
|
|
|
|
}
|
|
|
|
|
2017-05-10 14:52:58 +08:00
|
|
|
define i32 @test_zext_i1(i32 %a) {
|
|
|
|
; X64-LABEL: test_zext_i1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-05-10 14:52:58 +08:00
|
|
|
; X64-NEXT: andl $1, %edi
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_zext_i1:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2017-05-10 14:52:58 +08:00
|
|
|
; X32-NEXT: andl $1, %eax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
%val = trunc i32 %a to i1
|
|
|
|
%r = zext i1 %val to i32
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|
2017-05-01 14:30:16 +08:00
|
|
|
define i32 @test_zext_i8(i8 %val) {
|
|
|
|
; X64-LABEL: test_zext_i8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-05-01 14:30:16 +08:00
|
|
|
; X64-NEXT: movzbl %dil, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_zext_i8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
|
2017-05-01 14:30:16 +08:00
|
|
|
; X32-NEXT: retl
|
|
|
|
%r = zext i8 %val to i32
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_zext_i16(i16 %val) {
|
|
|
|
; X64-LABEL: test_zext_i16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-05-01 14:30:16 +08:00
|
|
|
; X64-NEXT: movzwl %di, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_zext_i16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
2017-05-01 14:30:16 +08:00
|
|
|
; X32-NEXT: retl
|
|
|
|
%r = zext i16 %val to i32
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_sext_i8(i8 %val) {
|
|
|
|
; X64-LABEL: test_sext_i8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-05-01 14:30:16 +08:00
|
|
|
; X64-NEXT: movsbl %dil, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_sext_i8:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
|
2017-05-01 14:30:16 +08:00
|
|
|
; X32-NEXT: retl
|
|
|
|
%r = sext i8 %val to i32
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_sext_i16(i16 %val) {
|
|
|
|
; X64-LABEL: test_sext_i16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-05-01 14:30:16 +08:00
|
|
|
; X64-NEXT: movswl %di, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
|
|
|
; X32-LABEL: test_sext_i16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
[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
|
|
|
; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
|
2017-05-01 14:30:16 +08:00
|
|
|
; X32-NEXT: retl
|
|
|
|
%r = sext i16 %val to i32
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|