Browse Source

* x86: Added two new tests for i39922

J. Gareth "Curious Kit" Moreton 2 years ago
parent
commit
6b77017cb9
2 changed files with 35 additions and 0 deletions
  1. 31 0
      tests/webtbs/tw39922.pp
  2. 4 0
      tests/webtbs/tw39922a.pp

+ 31 - 0
tests/webtbs/tw39922.pp

@@ -0,0 +1,31 @@
+{ %OPT=-O3 }
+
+{ Test triggers "mov $0,%reg" being inserted on the wrong side of a SETcc instruction }
+program tw39922.pp;
+
+{$mode objfpc}
+
+uses sysutils;
+
+function isAlpha(c : Byte): Integer;
+begin
+  if ((AnsiChar(c) >= 'A') and (AnsiChar(c) <= 'Z')) or
+     ((AnsiChar(c) >= 'a') and (AnsiChar(c) <= 'z'))
+  then
+    Result := 1
+  else
+    Result := 0;
+end;
+
+begin
+  if (isAlpha(Byte('u')) = 0) then
+    Halt(1);
+
+  if (isAlpha(Byte('A')) = 0) then
+    Halt(2);
+
+  if (isAlpha(Byte('2')) = 1) then
+    Halt(3);
+	
+  WriteLn('ok');
+end.

+ 4 - 0
tests/webtbs/tw39922a.pp

@@ -0,0 +1,4 @@
+{ %OPT=-O3 -Os }
+
+{ Test ensures the -Os version of "J(c)Mov1Jmp/RetMov0Jmp/Ret -> Set(~c)Jmp/Ret" is performed correctly }
+{$I tw39922.pp}