[PATCH] D20905: Only attempt to detect AVG if SSE2 is available

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 06:12:55 PDT 2016


spatel added a comment.

Thanks for working on the patch, Dimitry.

The test case can be simplified further to at least this:

  define <16 x i8> @fn1() {
    %t0 = zext <16 x i8> zeroinitializer to <16 x i32>
    %t1 = add nuw nsw <16 x i32> %t0, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
    %t2 = lshr <16 x i32> %t1, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
    %t3 = trunc <16 x i32> %t2 to <16 x i8>
    ret <16 x i8> %t3
  }

You can use "-mtriple=x86_64-unknown-unknown -mattr=-sse2" in the RUN line and remove all of the attributes/metadata. Please use FileCheck in the RUN line to verify correctness of the output rather than the absence of an assert. You can then use:
$ utils/update_test_checks.py --tool=../../../../build/bin/llc pr27973.ll
to auto-generate the CHECK lines (see other x86 regression tests for examples of what this looks like).


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:27847
@@ -27846,1 +27846,3 @@
+    return SDValue();
+  else if (Subtarget.hasAVX512()) {
     if (VT.getSizeInBits() > 512)
----------------
You can remove the 'else':
http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return


http://reviews.llvm.org/D20905





More information about the llvm-commits mailing list