1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- -mattr=avx512bw | FileCheck %s
4 ; This would infinite loop by trying to truncate to i16 and then promote back to i32.
6 define i16 @PR40793(<8 x i16> %t1) {
7 ; CHECK-LABEL: PR40793:
9 ; CHECK-NEXT: vpextrw $5, %xmm0, %ecx
10 ; CHECK-NEXT: andb $15, %cl
11 ; CHECK-NEXT: movl $32733, %eax # imm = 0x7FDD
12 ; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
13 ; CHECK-NEXT: shrl %cl, %eax
14 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
16 %t2 = and <8 x i16> %t1, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
17 %t3 = lshr <8 x i16> <i16 25156, i16 -14844, i16 -26779, i16 -16956, i16 -13978, i16 32733, i16 -24894, i16 18530>, %t2
18 %t4 = bitcast <8 x i16> %t3 to <2 x double>
19 %t5 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %t4)
20 %t6 = bitcast <2 x double> %t5 to <8 x i16>
21 %t7 = extractelement <8 x i16> %t6, i64 5
25 declare <2 x double> @llvm.fabs.v2f64(<2 x double>)
27 ; This would infinite loop by trying to truncate and any_extend.
29 %struct.anon = type { [9 x i8], [3 x i8] }
31 @b = common local_unnamed_addr global %struct.anon zeroinitializer, align 4
36 ; CHECK-NEXT: movzbl b+{{.*}}(%rip), %ecx
37 ; CHECK-NEXT: andl $7, %ecx
38 ; CHECK-NEXT: movl $d, %eax
39 ; CHECK-NEXT: addl %ecx, %eax
40 ; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
42 %bf.load = load i72, i72* bitcast (%struct.anon* @b to i72*), align 4
43 %bf.lshr = lshr i72 %bf.load, 64
44 %t0 = trunc i72 %bf.lshr to i64
45 %bf.cast = and i64 %t0, 7
46 %add.ptr = getelementptr i8, i8* bitcast (i32 ()* @d to i8*), i64 %bf.cast
47 %t1 = ptrtoint i8* %add.ptr to i64
48 %t2 = trunc i64 %t1 to i32