[PATCH] D49242: [Intrinsics] define funnel shift IR intrinsics + DAG builder support

Fabian Giesen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 10:56:53 PDT 2018


fabiang added a comment.

I added a few more notes on the docs.



================
Comment at: docs/LangRef.rst:11924
+
+      %r = call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 %z)  ; %r = i8: extract((concat(%x, %y) << %z), 0, 7)
+      %r = call i8 @llvm.fshl.i8(i8 255, i8 0, i8 15)  ; %r = i8: 128 (0b10000000)
----------------
I think this should be extract((contact(%x, %y) << %z), 8, 15) since it grabs the more significant half of the shifted double-width value.


================
Comment at: docs/LangRef.rst:11970
+
+      %r = call i8 @llvm.fshr.i8(i8 %x, i8 %y, i8 %z)  ; %r = i8: extract((concat(%x, %y) >> %z), 8, 15)
+      %r = call i8 @llvm.fshr.i8(i8 255, i8 0, i8 15)  ; %r = i8: 128 (0b00000001)
----------------
Conversely, this one should extract bits 0 through 7 not 8 through 15.


================
Comment at: docs/LangRef.rst:11971
+      %r = call i8 @llvm.fshr.i8(i8 %x, i8 %y, i8 %z)  ; %r = i8: extract((concat(%x, %y) >> %z), 8, 15)
+      %r = call i8 @llvm.fshr.i8(i8 255, i8 0, i8 15)  ; %r = i8: 128 (0b00000001)
+      %r = call i8 @llvm.fshr.i8(i8 15, i8 15, i8 11)  ; %r = i8: 225 (0b11100001)
----------------
I think this example needs the first and second arguments swapped. (Alternatively, the result should be 0xfe = 0b11111110)


https://reviews.llvm.org/D49242





More information about the llvm-commits mailing list