[llvm] [DAG] Support saturated truncate (PR #99418)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 01:09:10 PDT 2024


================
@@ -292,15 +292,15 @@ entry:
 
 ; Test the (concat_vectors (X), (trunc(umin(smax(Y, 0), 2^n))))) pattern.
 
+; TODO: %min is a value between 0 and 255 and is within the unsigned range of i8.
+; So it is saturated truncate. we have an optimization opportunity.
----------------
davemgreen wrote:

I'm pretty sure this should be matching a sqxtun2, that was the intent. I believe because the lower limit is already clamped, that the upper smin is equivalent to umin.
https://godbolt.org/z/e7ne31TYb
You can see in that example that the midend turned smin into umin.

https://github.com/llvm/llvm-project/pull/99418


More information about the llvm-commits mailing list