AVX-512: Extractelement is not optimal for i1 vectors
| Bugzilla Link | 33692 |
| Version | trunk |
| OS | Windows NT |
| CC | @hfinkel,@igor-breger,@RKSimon,@ZviRackover |
Extended Description
operation extractelement <16 x i1> %vec, i32 const // Not only 16 can generate more optimal code:
; This code in loop preheader %v_mask = icmp slt <16 x i32> %a, %b
; This code inside the loop vector body %s_mask = extractelement <16 x i1> %v_mask, i32 5 br i1 %s_mask, label %pred.if, label %pred.continue
pred.if:
..
pred.continue:
vpcmpgtd %zmm0, %zmm1, %k0 #The instructions bellow are inside the loop body
kshiftlw $10, %k0, %k0 kshiftrw $15, %k0, %k0 kmovd %k0, %eax testb $1, %al je .LBB0_2
More optimal code:
vpcmpgtd %zmm0, %zmm1, %k0 vpmovm2b %k0, %xmm2
#The instructions bellow will be inside the loop body
vpextrb %xmm2, %eax testb $1, %al je .LBB0_2
Current Codegen: https://gcc.godbolt.org/z/tXgzaY