Issue |
122872
|
Summary |
Add `vpavgb` and `vpavgw` patterns
|
Labels |
new issue
|
Assignees |
|
Reporter |
Validark
|
[Godbolt link](https://zig.godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:3,lang:zig,selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:'export+fn+foo(a:+@Vector(64,+u8),+b:+@Vector(64,+u8))+@Vector(64,+u8)+%7B%0A++++return+(a+%2B+b+%2B+@as(@TypeOf(a),+@splat(1)))+%3E%3E+@splat(1)%3B%0A%7D%0A'),l:'5',n:'0',o:'Zig+source+%233',t:'0')),header:(),k:53.18930041152264,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:ztrunk,filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1',verboseDemangling:'0'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:zig,libs:!(),options:'-O+ReleaseFast+-target+x86_64-linux+-mcpu%3Dznver5',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:3),l:'5',n:'0',o:'+zig+trunk+(Editor+%233)',t:'0')),header:(),k:46.81069958847738,l:'4',m:100,n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4)
```zig
export fn foo(a: @Vector(64, u8), b: @Vector(64, u8)) @Vector(64, u8) {
return (a + b + @as(@TypeOf(a), @splat(1))) >> @splat(1);
}
```
Gives:
```asm
.LCPI0_1:
.byte 0
.byte 128
.byte 64
.byte 32
.byte 16
.byte 8
.byte 4
.byte 2
foo:
vpaddb zmm0, zmm0, zmm1
vpternlogd zmm1, zmm1, zmm1, 255
vpsubb zmm0, zmm0, zmm1
vgf2p8affineqb zmm0, zmm0, qword ptr [rip + .LCPI0_1]{1to8}, 0
ret
```
Could probably give the `vpavgb` instruction?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs