#!/usr/bin/perl #!/usr/local/bin/perl # Test for pipeline hazard combinations use Getopt::Std; use lib "."; use tester; cmdline(); # Instruction templates $tcount = 8; @templates = ( "||jne target\n\thalt\ntarget:|", # M "|||ret", # R "||mrmovq (%rax),%rsp|ret", # G1a "|mrmovq (%rax),%rsp||ret", # G1b "mrmovq (%rax),%rsp|||ret", # G1c "||irmovq \$3,%rax|rrmovq %rax,%rdx", # G2a "|irmovq \$3,%rax||rrmovq %rax,%rdx", # G2b "irmovq \$3,%rax|||rrmovq %rax,%rdx", # G2c ); # Try combining two templates to generate test sequence sub make_test { local ($t1, $t2) = @_; $ok = 1; @test1 = split(/\|/, $t1); @test2 = split(/\|/, $t2); for ($i = 0; $i < 4; $i++) { if ($test1[$i] eq "") { if ($test2[$i] eq "") { $test[$i] = "nop"; } else { $test[$i] = $test2[$i]; } } else { if ($test2[$i] eq "") { $test[$i] = $test1[$i]; } else { if ($test1[$i] eq $test2[$i]) { # $ok = 0; $test[$i] = $test1[$i]; } else { $ok = 0; $test[$i] = "XXX"; } } } } if ($ok) { &gen_test($test[0], $test[1], $test[2], $test[3]); } } $testcnt = 0; # Generate test with 4 instructions inserted sub gen_test { local ($i1, $i2, $i3, $i4) = @_; $tname = "c-$testcnt"; $testcnt++; open(YFILE, ">$tname.ys") || die "Can't write to $tname.ys\n"; print YFILE <