diff llvm/test/TableGen/if.td @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
line wrap: on
line diff
--- a/llvm/test/TableGen/if.td	Mon May 25 11:55:54 2020 +0900
+++ b/llvm/test/TableGen/if.td	Tue Jun 08 06:07:14 2021 +0900
@@ -11,12 +11,12 @@
                !if(y{2}, x{0},
                !if(y{1}, x{1},
                !if(y{0}, x{2}, ?))));
-  let n{10-9}= !if(x{2}, y{3-2},
-               !if(x{1}, y{2-1},
-               !if(x{0}, y{1-0}, ?)));
-  let n{8-6} = !if(x{2}, 0b010, 0b110);
-  let n{5-4} = !if(x{1}, y{3-2}, {0, 1});
-  let n{3-0} = !if(x{0}, y{3-0}, {z, y{2}, y{1}, y{0}});
+  let n{10...9}= !if(x{2}, y{3...2},
+                 !if(x{1}, y{2...1},
+                 !if(x{0}, y{1...0}, ?)));
+  let n{8...6} = !if(x{2}, 0b010, 0b110);
+  let n{5...4} = !if(x{1}, y{3...2}, {0, 1});
+  let n{3...0} = !if(x{0}, y{3...0}, {z, y{2}, y{1}, y{0}});
 }
 
 def C1 : C<{1, 0, 1}, {0, 1, 0, 1}, 0>;
@@ -97,6 +97,39 @@
 def EXd1 : EX<1, E1d, E2d>;
 def EXd2 : EX<0, E1d, E2d>;
 
+// CHECK: def Not1
+// CHECK: Result1a = "OK"
+// CHECK: Result1b = "OK"
+// CHECK: Result1c = "OK"
+// CHECK: Result1d = "OK"
+// CHECK: Result1e = "OK"
+// CHECK: def Not2
+// CHECK: Result2a = "OK"
+// CHECK: Result2b = "OK"
+// CHECK: Result2c = "OK"
+// CHECK: Result2d = "OK"
+
+def Not1 {
+  bit True = 1;
+  string Result1a = !if(True, "OK", "not OK");
+  string Result1b = !if(!not(True), "not OK", "OK");
+
+  bit False = 0;
+  string Result1c = !if(False, "not OK", "OK");
+  string Result1d = !if(!not(False), "OK", "not OK");
+  string Result1e = !if(!not(!not(False)), "not OK", "OK");
+}
+
+def Not2 {
+  int one = 1;
+  string Result2a = !if(one, "OK", "not OK");
+  string Result2b = !if(!not(one), "not OK", "OK");
+
+  int zero = 0;
+  string Result2c = !if(zero, "not OK", "OK");
+  string Result2d = !if(!not(zero), "OK", "not OK");
+}
+
 // CHECK:      def One
 // CHECK-NEXT: list<int> first = [1, 2, 3];
 // CHECK-NEXT: list<int> rest = [1, 2, 3];