{"action":"created","issue":{"url":"https://api.github.com/repos/eschkufz/x64asm/issues/147","labels_url":"https://api.github.com/repos/eschkufz/x64asm/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/eschkufz/x64asm/issues/147/comments","events_url":"https://api.github.com/repos/eschkufz/x64asm/issues/147/events","html_url":"https://github.com/eschkufz/x64asm/issues/147","id":57121004,"number":147,"title":"movdqu - validation test fails ","user":{"login":"rknath","id":5818995,"avatar_url":"https://avatars.githubusercontent.com/u/5818995?v=3","gravatar_id":"","url":"https://api.github.com/users/rknath","html_url":"https://github.com/rknath","followers_url":"https://api.github.com/users/rknath/followers","following_url":"https://api.github.com/users/rknath/following{/other_user}","gists_url":"https://api.github.com/users/rknath/gists{/gist_id}","starred_url":"https://api.github.com/users/rknath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rknath/subscriptions","organizations_url":"https://api.github.com/users/rknath/orgs","repos_url":"https://api.github.com/users/rknath/repos","events_url":"https://api.github.com/users/rknath/events{/privacy}","received_events_url":"https://api.github.com/users/rknath/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-10T02:13:29Z","updated_at":"2015-02-10T06:02:07Z","closed_at":"2015-02-10T06:02:07Z","body":"movdqu 0x1000, %xmm1\r\n\r\nIt fails during validation. \r\n\r\nis it because of the memory operand ???? \r\n\r\ngit_diff \r\ndiff --git a/Makefile b/Makefile\r\nindex 66b78da..3260294 100644\r\n--- a/Makefile\r\n+++ b/Makefile\r\n@@ -13,8 +13,8 @@\r\n # limitations under the License.\r\n \r\n ##### CONSTANT DEFINITIONS\r\n-\r\n-CXX=ccache g++ -std=c++11 -Werror -Wextra -Wfatal-errors\r\n+CCACHES=#ccache \r\n+CXX=$(CCACHES) g++ -std=c++11 -Werror -Wextra -Wfatal-errors\r\n \r\n INC_FOLDERS=\\\r\n \t\t\t\t\t\t./ \\\r\n@@ -198,12 +198,12 @@ src/ext/astyle:\r\n \t$(MAKE) -C src/ext/astyle/build/gcc -j8\r\n \r\n src/ext/cpputil:\r\n-\tgit clone git://github.com/eschkufz/cpputil.git src/ext/cpputil && \\\r\n+\tgit clone https://github.com/eschkufz/cpputil src/ext/cpputil && \\\r\n \tcd src/ext/cpputil && \\\r\n \tgit checkout e7b99c1\r\n \r\n src/ext/x64asm:\r\n-\tgit clone git://github.com/eschkufz/x64asm.git src/ext/x64asm && \\\r\n+\tgit clone https://github.com/eschkufz/x64asm src/ext/x64asm && \\\r\n \tcd src/ext/x64asm && \\\r\n \tgit checkout fbddb33 \r\n \r\ndiff --git a/src/validator/handlers/packed_handler.cc b/src/validator/handlers/packed_handler.cc\r\nindex 0cad40b..5bff6f9 100644\r\n--- a/src/validator/handlers/packed_handler.cc\r\n+++ b/src/validator/handlers/packed_handler.cc\r\n@@ -100,6 +100,12 @@ void PackedHandler::build_circuit(const x64asm::Instruction& instr, SymState& st\r\n \r\n   // Compute the result\r\n   SymBitVector result;\r\n+  if( opcode ==\"psllw\" || opcode == \"psrlw\"){\r\n+     cout <<\" psllw handler \\n\";\r\n+     state.set(instr.get_operand<Operand>(0), arg1,  instr.is_avx() || instr.is_avx2() ) ;\r\n+     return;\r\n+  }\r\n+\r\n \r\n   if(limit) {\r\n     // Only apply binop to lower bits.  Useful for scalar operations.\r\ndiff --git a/src/validator/handlers/packed_handler.h b/src/validator/handlers/packed_handler.h\r\nindex b314b29..7fc1a4d 100644\r\n--- a/src/validator/handlers/packed_handler.h\r\n+++ b/src/validator/handlers/packed_handler.h\r\n@@ -690,6 +690,14 @@ public:\r\n       return a ^ b;\r\n     }, 0);\r\n \r\n+    add_opcode(\"psllw\", [](SymBitVector a, SymBitVector b) {\r\n+      return a;\r\n+    },128,128, false, false);\r\n+\r\n+    add_opcode(\"psrlw\", [](SymBitVector a, SymBitVector b) {\r\n+      return a;\r\n+    },128,128, false, false);\r\n+\r\n \r\n   }\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\ncat movdqu.h \r\nclass ValidatorMovdquTest : public ValidatorTest {};\r\n\r\nTEST_F(ValidatorMovdquTest, NotANoop) {\r\n\r\n  target_ << \"movdqu  0x1000, %xmm1\" << std::endl;\r\n  target_ << \"retq\" << std::endl;\r\n\r\n  //rewrite_ << \"movdqu  %xmm7, %ebx\" << std::endl;\r\n  rewrite_ << \"retq\" << std::endl;\r\n\r\n  assert_ceg();\r\n}\r\nTEST_F(ValidatorMovdquTest, Identity) {\r\n\r\n  target_ << \"movdqu  0x1000, %xmm1\" << std::endl;\r\n  target_ << \"retq\" << std::endl;\r\n\r\n  rewrite_ << \"movdqu  0x1000, %xmm1\" << std::endl;\r\n  rewrite_ << \"retq\" << std::endl;\r\n\r\n  assert_equiv();\r\n}\r\nTEST_F(ValidatorMovdquTest, LooksCorrect) {\r\n\r\n  target_ << \"movdqu  0x1000, %xmm1\" << std::endl;\r\n  target_ << \"retq\" << std::endl;\r\n\r\n  stoke::Sandbox sb;\r\n  sb.set_abi_check(false);\r\n  stoke::StateGen sg(&sb);\r\n  stoke::CpuState cs;\r\n  sg.get(cs);\r\n\r\n  set_live_outs(x64asm::RegSet::empty() + x64asm::xmm1);\r\n\r\n  check_circuit(cs);\r\n\r\n}\r\n\r\nTEST_F(ValidatorMovdquTest, HardwareTest1){\r\n\r\n  target_ << \"movdqu  0x1000, %xmm1\" << std::endl;\r\n  target_ << \"retq\" << std::endl;\r\n\r\n  stoke::Sandbox sb;\r\n  sb.set_abi_check(false);\r\n  stoke::StateGen sg(&sb);\r\n  stoke::CpuState cs;\r\n  sg.get(cs);\r\n  cs.sse[x64asm::ymm1].get_fixed_quad(0) = 0x0001000200030004; \r\n  cs.sse[x64asm::ymm1].get_fixed_quad(1) = 0x0005000600070008; \r\n  cs.sse[x64asm::ymm1].get_fixed_quad(2) = 0xffffffffffffffff; \r\n  cs.sse[x64asm::ymm1].get_fixed_quad(3) = 0xffffffffffffffff; \r\n  set_live_outs(x64asm::RegSet::empty()  + x64asm::xmm1);\r\n  check_circuit(cs);\r\n} \r\n\r\n\r\n\r\n\r\n\r\n[  FAILED  ] ValidatorMovdquTest.NotANoop\r\n[  FAILED  ] ValidatorMovdquTest.Identity\r\n[  FAILED  ] ValidatorMovdquTest.LooksCorrect\r\n[  FAILED  ] ValidatorMovdquTest.HardwareTest1\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eschkufz/x64asm/issues/comments/73649166","html_url":"https://github.com/eschkufz/x64asm/issues/147#issuecomment-73649166","issue_url":"https://api.github.com/repos/eschkufz/x64asm/issues/147","id":73649166,"user":{"login":"bchurchill","id":640745,"avatar_url":"https://avatars.githubusercontent.com/u/640745?v=3","gravatar_id":"","url":"https://api.github.com/users/bchurchill","html_url":"https://github.com/bchurchill","followers_url":"https://api.github.com/users/bchurchill/followers","following_url":"https://api.github.com/users/bchurchill/following{/other_user}","gists_url":"https://api.github.com/users/bchurchill/gists{/gist_id}","starred_url":"https://api.github.com/users/bchurchill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bchurchill/subscriptions","organizations_url":"https://api.github.com/users/bchurchill/orgs","repos_url":"https://api.github.com/users/bchurchill/repos","events_url":"https://api.github.com/users/bchurchill/events{/privacy}","received_events_url":"https://api.github.com/users/bchurchill/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T06:02:07Z","updated_at":"2015-02-10T06:02:07Z","body":"I don't think the validator has support for immediate memory offsets as it is, but this would be easy to do, I think.\r\n\r\nYou need to explicitly setup the CpuState to map memmory starting at 0x1000.  Take a look in the state/ folder, and (I think) the file is memory.h.  This isn't an x64asm issue though (x64asm is just the assembler, not the rest of stoke).  I'll close this."}}