xbyak/test/nm_frame.cpp

43 lines
883 B
C++
Raw Permalink Normal View History

2010-04-15 18:33:04 -07:00
#include <stdio.h>
2016-08-02 21:19:02 -07:00
#define XBYAK_ENABLE_OMITTED_OPERAND
2010-04-15 18:33:04 -07:00
#include "xbyak/xbyak.h"
2020-02-25 23:24:47 -07:00
#define CYBOZU_TEST_DISABLE_AUTO_RUN
#include "cybozu/test.hpp"
2010-04-15 18:33:04 -07:00
using namespace Xbyak;
2015-08-17 19:55:10 -07:00
#ifdef _MSC_VER
#pragma warning(disable : 4245)
2017-08-21 23:53:34 -07:00
#pragma warning(disable : 4312)
2015-08-17 19:55:10 -07:00
#endif
2010-04-15 18:33:04 -07:00
class Sample : public CodeGenerator {
void operator=(const Sample&);
public:
#include "nm.cpp"
};
class ErrorSample : public CodeGenerator {
void operator=(const ErrorSample&);
public:
void gen()
{
#ifndef XBYAK_NO_EXCEPTION
2020-02-25 23:24:47 -07:00
CYBOZU_TEST_EXCEPTION(mov(ptr[eax],1), std::exception);
CYBOZU_TEST_EXCEPTION(test(ptr[eax],1), std::exception);
CYBOZU_TEST_EXCEPTION(adc(ptr[eax],1), std::exception);
CYBOZU_TEST_EXCEPTION(setz(eax), std::exception);
2020-07-20 02:24:34 -07:00
#endif
2010-04-15 18:33:04 -07:00
}
};
2020-02-25 23:24:47 -07:00
2010-04-15 18:33:04 -07:00
int main()
{
2020-06-27 13:49:05 -07:00
// the size of Operand exceeds 32 bit.
CYBOZU_TEST_EQUAL(sizeof(Xbyak::Operand), 8u);
2020-02-25 23:24:47 -07:00
Sample s;
s.gen();
2010-04-15 18:33:04 -07:00
ErrorSample es;
es.gen();
}