1# RUN: not --crash llc -o - %s -mtriple=x86_64-- -verify-machineinstrs -run-pass=none 2>&1 | FileCheck %s
2# REQUIRES: x86-registered-target
3
4# CHECK: Bad machine code: Generic extend/truncate can not operate on pointers
5# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
6# CHECK-NEXT: - basic block: %bb.1
7# CHECK-NEXT: - instruction: %t_p:_(s32) = G_TRUNC %p:_(p0)
8
9# CHECK: Bad machine code: operand types must be all-vector or all-scalar
10# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
11# CHECK-NEXT: - basic block: %bb.2
12# CHECK-NEXT: - instruction: %se_i32:_(<2 x s64>) = G_SEXT %i32:_(s32)
13
14# CHECK: Bad machine code: operand types must preserve number of vector elements
15# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
16# CHECK-NEXT: - basic block: %bb.3
17# CHECK-NEXT: - instruction: %ze_v2i32:_(<4 x s64>) = G_ZEXT %v2i32:_(<2 x s32>)
18
19# CHECK: Bad machine code: Generic extend has destination type no larger than source
20# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
21# CHECK-NEXT: - basic block: %bb.4
22# CHECK-NEXT: - instruction: %ae_i32:_(s32) = G_ANYEXT %i32:_(s32)
23
24# CHECK: Bad machine code: Generic truncate has destination type no smaller than source ***
25# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
26# CHECK-NEXT: - basic block: %bb.5
27# CHECK-NEXT: - instruction: %ft_f32:_(s64) = G_FPTRUNC %f32:_(s32)
28
29
30# CHECK: Bad machine code: Generic extend/truncate can not operate on pointers
31# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
32# CHECK-NEXT: - basic block: %bb.6
33# CHECK-NEXT: - instruction: %ze_v2i128:_(<4 x p0>) = G_ZEXT %v2i128:_(<2 x s128>)
34
35# CHECK: Bad machine code: operand types must preserve number of vector elements
36# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
37# CHECK-NEXT: - basic block: %bb.6
38# CHECK-NEXT: - instruction: %ze_v2i128:_(<4 x p0>) = G_ZEXT %v2i128:_(<2 x s128>)
39
40# CHECK: Bad machine code: Generic extend has destination type no larger than source
41# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
42# CHECK-NEXT: - basic block: %bb.6
43# CHECK-NEXT: - instruction: %ze_v2i128:_(<4 x p0>) = G_ZEXT %v2i128:_(<2 x s128>)
44
45
46# CHECK: Bad machine code: Generic extend/truncate can not operate on pointers
47# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
48# CHECK-NEXT: - basic block: %bb.6
49# CHECK-NEXT: - instruction: %fe_v2f128:_(p0) = G_FPEXT %v2f128:_(<2 x s128>)
50
51# CHECK: Bad machine code: operand types must be all-vector or all-scalar
52# CHECK-NEXT: - function:    bad_generic_extends_and_truncates
53# CHECK-NEXT: - basic block: %bb.6
54# CHECK-NEXT: - instruction: %fe_v2f128:_(p0) = G_FPEXT %v2f128:_(<2 x s128>)
55
56---
57name:              bad_generic_extends_and_truncates
58tracksRegLiveness: true
59body:              |
60  bb.0:
61    liveins: $rdi, $esi, $rdx, $xmm0, $ymm1, $ymm2
62
63    %p:_(p0) = COPY $rdi
64    %i32:_(s32) = COPY $esi
65    %v2i32:_(<2 x s32>) = COPY $rdx
66    %f32:_(s32) = COPY $xmm0
67    %v2i128:_(<2 x s128>) = COPY $ymm1
68    %v2f128:_(<2 x s128>) = COPY $ymm2
69
70  bb.1:
71    %t_p:_(s32) = G_TRUNC %p
72
73  bb.2:
74    %se_i32:_(<2 x s64>) = G_SEXT %i32
75
76  bb.3:
77    %ze_v2i32:_(<4 x s64>) = G_ZEXT %v2i32
78
79  bb.4:
80    %ae_i32:_(s32) = G_ANYEXT %i32
81
82  bb.5:
83    %ft_f32:_(s64) = G_FPTRUNC %f32
84
85  bb.6:
86    %ze_v2i128:_(<4 x p0>) = G_ZEXT %v2i128
87    %fe_v2f128:_(p0) = G_FPEXT %v2f128
88...
89